Reissue 1.18 - same code, corrected metadata.
[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 #define NDWARVES       {ndwarflocs}          // number of dwarves
39 extern const int dwarflocs[NDWARVES];
40
41 typedef struct {{
42   const char** strs;
43   const int n;
44 }} string_group_t;
45
46 typedef struct {{
47   const string_group_t words;
48   const char* inventory;
49   int plac, fixd;
50   bool is_treasure;
51   const char** descriptions;
52   const char** sounds;
53   const char** texts;
54   const char** changes;
55 }} object_t;
56
57 typedef struct {{
58   const char* small;
59   const char* big;
60 }} descriptions_t;
61
62 typedef struct {{
63   descriptions_t description;
64   const long sound;
65   const bool loud;
66 }} location_t;
67
68 typedef struct {{
69   const char* query;
70   const char* yes_response;
71 }} obituary_t;
72
73 typedef struct {{
74   const int threshold;
75   const int point_loss;
76   const char* message;
77 }} turn_threshold_t;
78
79 typedef struct {{
80   const int threshold;
81   const char* message;
82 }} class_t;
83
84 typedef struct {{
85   const int number;
86   const int turns;
87   const int penalty;
88   const char* question;
89   const char* hint;
90 }} hint_t;
91
92 typedef struct {{
93   const string_group_t words;
94 }} motion_t;
95
96 typedef struct {{
97   const string_group_t words;
98   const char* message;
99   const bool noaction;
100 }} action_t;
101
102 enum condtype_t {{cond_goto, cond_pct, cond_carry, cond_with, cond_not}};
103 enum desttype_t {{dest_goto, dest_special, dest_speak}};
104
105 typedef struct {{
106   const long motion;
107   const long condtype;
108   const long condarg1;
109   const long condarg2;
110   const enum desttype_t desttype;
111   const long destval;
112   const bool nodwarves;
113   const bool stop;
114 }} travelop_t;
115
116 extern const location_t locations[];
117 extern const object_t objects[];
118 extern const char* arbitrary_messages[];
119 extern const class_t classes[];
120 extern const turn_threshold_t turn_thresholds[];
121 extern const obituary_t obituaries[];
122 extern const hint_t hints[];
123 extern long conditions[];
124 extern const motion_t motions[];
125 extern const action_t actions[];
126 extern const travelop_t travel[];
127 extern const long tkey[];
128 extern const char *ignore;
129
130 #define NLOCATIONS      {num_locations}
131 #define NOBJECTS        {num_objects}
132 #define NHINTS          {num_hints}
133 #define NCLASSES        {num_classes}
134 #define NDEATHS         {num_deaths}
135 #define NTHRESHOLDS     {num_thresholds}
136 #define NMOTIONS    {num_motions}
137 #define NACTIONS        {num_actions}
138 #define NTRAVEL         {num_travel}
139 #define NKEYS           {num_keys}
140
141 #define BIRD_ENDSTATE {bird_endstate}
142
143 enum arbitrary_messages_refs {{
144 {arbitrary_messages}
145 }};
146
147 enum locations_refs {{
148 {locations}
149 }};
150
151 enum object_refs {{
152 {objects}
153 }};
154
155 enum motion_refs {{
156 {motions}
157 }};
158
159 enum action_refs {{
160 {actions}
161 }};
162
163 /* State definitions */
164
165 {state_definitions}
166
167 #endif /* end DUNGEON_H */