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