comparison srogue/rogue.h @ 36:2128c7dc8a40

Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
author elwin
date Thu, 25 Nov 2010 12:21:41 +0000
parents
children 15f8229f38c1
comparison
equal deleted inserted replaced
35:05018c63a721 36:2128c7dc8a40
1 /*
2 * Rogue definitions and variable declarations
3 *
4 * @(#)rogue.h 9.0 (rdk) 7/17/84
5 *
6 * Super-Rogue
7 * Copyright (C) 1984 Robert D. Kindelberger
8 * All rights reserved.
9 *
10 * Based on "Rogue: Exploring the Dungeons of Doom"
11 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
12 * All rights reserved.
13 *
14 * See the file LICENSE.TXT for full copyright and licensing information.
15 */
16
17 #ifdef BSD
18 #include "cx.h"
19 #endif
20
21
22 #include <ctype.h>
23 #include <curses.h>
24
25 #ifdef ATT
26 #define CBREAK FALSE
27 #define _IOSTRG 01
28 #endif
29
30 #define reg register /* register abbr. */
31
32 /*
33 * Maximum number of different things
34 */
35
36 #define NCOLORS 32
37 #define NSYLS 159
38 #define NSTONES 35
39 #define NWOOD 24
40 #define NMETAL 15
41
42 #define MAXDAEMONS 20
43
44 #define TYPETRAPS 9 /* max types of traps */
45 #define MAXROOMS 9 /* max rooms per level */
46 #define MAXTHINGS 9 /* max things on each level */
47 #define MAXOBJ 9 /* max goodies on each level */
48 #define MAXPACK 23 /* max things this hero can carry */
49 #define MAXTRAPS 10 /* max traps per level */
50 #define MAXMONS 52 /* max available monsters */
51 #define MONRANGE 20 /* max # of monsters avail each level */
52 #define AMLEVEL 35 /* earliest level that amulet can appear */
53 #define MAXPURCH 4 /* max purchases in trading post */
54 #define MINABIL 3 /* minimum for any ability */
55 #define MAXSTR 24 /* maximum strength */
56 #define MAXOTHER 18 /* maximum wis, dex, con */
57 #define NORMAC 10 /* normal hero armor class (no armor) */
58 #define MONWIS 10 /* monsters standard wisdom */
59
60 #define NORMLEV 0 /* normal level */
61 #define POSTLEV 1 /* trading post level */
62 #define MAZELEV 2 /* maze level */
63
64 #define NORMFOOD 0 /* normal food's group no. */
65 #define FRUITFOOD 1 /* fruit's group no. */
66 #define NEWGROUP 2 /* start of group no. other than food */
67
68 #define NUMTHINGS 8 /* types of goodies for hero */
69 #define TYP_POTION 0
70 #define TYP_SCROLL 1
71 #define TYP_FOOD 2
72 #define TYP_WEAPON 3
73 #define TYP_ARMOR 4
74 #define TYP_RING 5
75 #define TYP_STICK 6
76 #define TYP_AMULET 7
77
78 #define V_PACK 3600 /* max volume in pack */
79 #define V_POTION 50 /* volume of potion */
80 #define V_SCROLL 80 /* volume of scroll */
81 #define V_FOOD 35 /* volume of food */
82 #define V_WEAPON 0 /* volume of weapon (depends on wep) */
83 #define V_ARMOR 0 /* volume of armor (depends on armor) */
84 #define V_RING 20 /* volume of ring */
85 #define V_STICK 0 /* volume of stick (depends on staff/wand) */
86 #define V_AMULET 30 /* volume of amulet */
87
88 #define V_WS_STAFF 200 /* volume of a staff */
89 #define V_WS_WAND 110 /* volume of a wand */
90 #define W_WS_STAFF 100 /* weight of a staff */
91 #define W_WS_WAND 60 /* weight of a wand */
92
93 #define FROMRING 2
94 #define DONTCARE -1
95 #define ANYTHING -1,-1 /* DONTCARE, DONTCARE */
96
97 #define K_ARROW 240 /* killed by an arrow */
98 #define K_DART 241 /* killed by a dart */
99 #define K_BOLT 242 /* killed by a bolt */
100 #define K_POOL 243 /* killed by drowning */
101 #define K_ROD 244 /* killed by an exploding rod */
102 #define K_SCROLL 245 /* killed by a burning scroll */
103 #define K_STONE 246 /* killed by materializing in rock */
104 #define K_STARVE 247 /* killed by starvation */
105 /*
106 * return values for get functions
107 */
108
109 #define NORM 0 /* normal exit */
110 #define QUIT 1 /* quit option setting */
111 #define MINUS 2 /* back up one option */
112
113 /*
114 * Return values for games end
115 */
116 #define KILLED 0 /* hero was killed */
117 #define CHICKEN 1 /* hero chickened out (quit) */
118 #define WINNER 2 /* hero was a total winner */
119
120 /*
121 * return values for chase routines
122 */
123 #define CHASE 0 /* continue chasing hero */
124 #define FIGHT 1 /* fight the hero */
125 #define GONER 2 /* chaser fell into a trap */
126
127 /*
128 * All the fun defines
129 */
130 #define next(ptr) (*ptr).l_next
131 #define prev(ptr) (*ptr).l_prev
132 #define ldata(ptr) (*ptr).l_data
133 #define OBJPTR(what) (struct object *)((*what).l_data)
134 #define THINGPTR(what) (struct thing *)((*what).l_data)
135
136 #define inroom(rp, cp) (\
137 (cp)->x <= (rp)->r_pos.x + ((rp)->r_max.x - 1) && \
138 (rp)->r_pos.x <= (cp)->x && (cp)->y <= (rp)->r_pos.y + \
139 ((rp)->r_max.y - 1) && (rp)->r_pos.y <= (cp)->y)
140
141 #define unc(cp) (cp).y, (cp).x
142 #define cmov(xy) move((xy).y, (xy).x)
143 #define DISTANCE(y1,x1,y2,x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
144 #define when break;case
145 #define otherwise break;default
146 #define until(expr) while(!(expr))
147
148 #define ce(a, b) ((a).x == (b).x && (a).y == (b).y)
149 #define draw(window) wrefresh(window)
150
151 #define hero player.t_pos
152 #define pstats player.t_stats
153 #define pack player.t_pack
154
155 #define herowis() (getpwis(him))
156 #define herodex() (getpdex(him,FALSE))
157 #define herostr() (pstats.s_ef.a_str)
158 #define herocon() (pstats.s_ef.a_con)
159
160 #define attach(a,b) _attach(&a,b)
161 #define detach(a,b) _detach(&a,b)
162 #define free_list(a) _free_list(&a)
163 #ifndef max
164 #define max(a, b) ((a) > (b) ? (a) : (b))
165 #endif
166 #define goingup() (level < max_level)
167
168 #define on(thing, flag) (((thing).t_flags & flag) != 0)
169 #define off(thing, flag) (((thing).t_flags & flag) == 0)
170 #undef CTRL
171 #define CTRL(ch) (ch & 0x1F)
172
173 #define ALLOC(x) malloc((unsigned int) x)
174 #define FREE(x) free((char *) x)
175 #define EQSTR(a, b, c) (strncmp(a, b, c) == 0)
176 #define GOLDCALC (rnd(50 + 10 * level) + 2)
177 #define ISMULT(type) (type == POTION || type == SCROLL || type == FOOD)
178
179 #define newgrp() ++group
180 #define o_charges o_ac
181
182
183 /*
184 * Things that appear on the screens
185 */
186 #define PASSAGE '#'
187 #define DOOR '+'
188 #define FLOOR '.'
189 #define PLAYER '@'
190 #define POST '^'
191 #define MAZETRAP '\\'
192 #define TRAPDOOR '>'
193 #define ARROWTRAP '{'
194 #define SLEEPTRAP '$'
195 #define BEARTRAP '}'
196 #define TELTRAP '~'
197 #define DARTTRAP '`'
198 #define POOL '"'
199 #define SECRETDOOR '&'
200 #define STAIRS '%'
201 #define GOLD '*'
202 #define POTION '!'
203 #define SCROLL '?'
204 #define MAGIC '$'
205 #define FOOD ':'
206 #define WEAPON ')'
207 #define ARMOR ']'
208 #define AMULET ','
209 #define RING '='
210 #define STICK '/'
211 #define CALLABLE -1
212
213
214 /*
215 * stuff to do with encumberence
216 */
217 #define NORMENCB 1500 /* normal encumberence */
218 #define SOMTHERE 5 /* something is in the way for dropping */
219 #define CANTDROP 6 /* cant drop it cause its cursed */
220 #define F_OKAY 0 /* have plenty of food in stomach */
221 #define F_HUNGRY 1 /* player is hungry */
222 #define F_WEAK 2 /* weak from lack of food */
223 #define F_FAINT 3 /* fainting from lack of food */
224
225
226 /*
227 * Various constants
228 */
229 #define PASSWD "mTuZ7WUV9RWkQ"
230 #define BEARTIME 3
231 #define SLEEPTIME 5
232 #define HEALTIME 30
233 #define HOLDTIME 2
234 #define STPOS 0
235 #define WANDERTIME 70
236 #define BEFORE 1
237 #define AFTER 2
238 #define HUHDURATION 20
239 #define SEEDURATION 850
240 #define HUNGERTIME 1300
241 #define WEAKTIME 150
242 #define HUNGTIME 300 /* 2 * WEAKTIME */
243 #define STOMACHSIZE 2000
244 #define ESCAPE 27
245 #define LEFT 0
246 #define RIGHT 1
247 #define BOLT_LENGTH 6
248
249 #define STR 1
250 #define DEX 2
251 #define CON 3
252 #define WIS 4
253
254 /*
255 * Save against things
256 */
257 #define VS_POISON 00
258 #define VS_PARALYZATION 00
259 #define VS_DEATH 00
260 #define VS_PETRIFICATION 01
261 #define VS_BREATH 02
262 #define VS_MAGIC 03
263
264
265 /*
266 * Various flag bits
267 */
268 #define ISSTUCK 0000001 /* monster can't run (violet fungi) */
269 #define ISDARK 0000001 /* room is dark */
270 #define ISCURSED 000001 /* object is cursed */
271 #define ISBLIND 0000001 /* hero is blind */
272 #define ISPARA 0000002 /* monster is paralyzed */
273 #define ISGONE 0000002 /* room is gone */
274 #define ISKNOW 0000002 /* object is known */
275 #define ISRUN 0000004 /* Hero & monsters are running */
276 #define ISTREAS 0000004 /* room is a treasure room */
277 #define ISPOST 0000004 /* object is in a trading post */
278 #define ISFOUND 0000010 /* trap is found */
279 #define ISINVINC 000010 /* player is invincible */
280 #define ISINVIS 0000020 /* monster is invisible */
281 #define ISPROT 0000020 /* object is protected somehow */
282 #define ISMEAN 0000040 /* monster is mean */
283 #define ISBLESS 0000040 /* object is blessed */
284 #define ISGREED 0000100 /* monster is greedy */
285 #define ISWOUND 0000200 /* monster is wounded */
286 #define ISHELD 0000400 /* hero is held fast */
287 #define ISHUH 0001000 /* hero | monster is confused */
288 #define ISREGEN 0002000 /* monster is regenerative */
289 #define CANHUH 0004000 /* hero can confuse monsters */
290 #define CANSEE 0010000 /* hero can see invisible monsters */
291 #define WASHIT 0010000 /* hero has hit monster at least once */
292 #define ISMISL 0020000 /* object is normally thrown in attacks */
293 #define ISCANC 0020000 /* monsters special attacks are canceled */
294 #define ISMANY 0040000 /* objects are found in a group (> 1) */
295 #define ISSLOW 0040000 /* hero | monster is slow */
296 #define ISHASTE 0100000 /* hero | monster is fast */
297 #define ISETHER 0200000 /* hero is thin as air */
298 #define NONE 100 /* equal to 'd' (used for weaps) */
299
300
301 /*
302 * Potion types
303 */
304 #define P_CONFUSE 0 /* confusion */
305 #define P_PARALYZE 1 /* paralysis */
306 #define P_POISON 2 /* poison */
307 #define P_STRENGTH 3 /* gain strength */
308 #define P_SEEINVIS 4 /* see invisible */
309 #define P_HEALING 5 /* healing */
310 #define P_MFIND 6 /* monster detection */
311 #define P_TFIND 7 /* magic detection */
312 #define P_RAISE 8 /* raise level */
313 #define P_XHEAL 9 /* extra healing */
314 #define P_HASTE 10 /* haste self */
315 #define P_RESTORE 11 /* restore strength */
316 #define P_BLIND 12 /* blindness */
317 #define P_NOP 13 /* thirst quenching */
318 #define P_DEX 14 /* increase dexterity */
319 #define P_ETH 15 /* etherealness */
320 #define P_SMART 16 /* wisdom */
321 #define P_REGEN 17 /* regeneration */
322 #define P_SUPHERO 18 /* super ability */
323 #define P_DECREP 19 /* decrepedness */
324 #define P_INVINC 20 /* invicibility */
325 #define MAXPOTIONS 21 /* types of potions */
326
327
328 /*
329 * Scroll types
330 */
331 #define S_CONFUSE 0 /* monster confusion */
332 #define S_MAP 1 /* magic mapping */
333 #define S_LIGHT 2 /* light */
334 #define S_HOLD 3 /* hold monster */
335 #define S_SLEEP 4 /* sleep */
336 #define S_ARMOR 5 /* enchant armor */
337 #define S_IDENT 6 /* identify */
338 #define S_SCARE 7 /* scare monster */
339 #define S_GFIND 8 /* gold detection */
340 #define S_TELEP 9 /* teleportation */
341 #define S_ENCH 10 /* enchant weapon */
342 #define S_CREATE 11 /* create monster */
343 #define S_REMOVE 12 /* remove curse */
344 #define S_AGGR 13 /* aggravate monster */
345 #define S_NOP 14 /* blank paper */
346 #define S_GENOCIDE 15 /* genocide */
347 #define S_KNOWALL 16 /* item knowledge */
348 #define S_PROTECT 17 /* item protection */
349 #define S_DCURSE 18 /* demons curse */
350 #define S_DLEVEL 19 /* transport */
351 #define S_ALLENCH 20 /* enchantment */
352 #define S_BLESS 21 /* gods blessing */
353 #define S_MAKEIT 22 /* aquirement */
354 #define S_BAN 23 /* banishment */
355 #define S_CWAND 24 /* charge wands */
356 #define S_LOCTRAP 25 /* locate traps */
357 #define MAXSCROLLS 26 /* types of scrolls */
358
359
360 /*
361 * Weapon types
362 */
363 #define MACE 0 /* mace */
364 #define SWORD 1 /* long sword */
365 #define BOW 2 /* short bow */
366 #define ARROW 3 /* arrow */
367 #define DAGGER 4 /* dagger */