Mercurial > hg > early-roguelike
comparison rogue5/extern.c @ 33:f502bf60e6e4
Import Rogue 5.4 from the Roguelike Restoration Project (r1490)
author | elwin |
---|---|
date | Mon, 24 May 2010 20:10:59 +0000 |
parents | |
children | 655c317b6237 |
comparison
equal
deleted
inserted
replaced
32:2dcd75e6a736 | 33:f502bf60e6e4 |
---|---|
1 /* | |
2 * global variable initializaton | |
3 * | |
4 * @(#)extern.c 4.82 (Berkeley) 02/05/99 | |
5 * | |
6 * Rogue: Exploring the Dungeons of Doom | |
7 * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman | |
8 * All rights reserved. | |
9 * | |
10 * See the file LICENSE.TXT for full copyright and licensing information. | |
11 */ | |
12 | |
13 /* All global variables are defined here, or in vers.c or init.c */ | |
14 | |
15 #include <curses.h> | |
16 #include "rogue.h" | |
17 | |
18 int after; /* True if we want after daemons */ | |
19 int again; /* Repeating the last command */ | |
20 int noscore; /* Was a wizard sometime */ | |
21 int seenstairs; /* Have seen the stairs (for lsd) */ | |
22 int amulet = FALSE; /* He found the amulet */ | |
23 int door_stop = FALSE; /* Stop running when we pass a door */ | |
24 int fight_flush = FALSE; /* True if toilet input */ | |
25 int firstmove = FALSE; /* First move after setting door_stop */ | |
26 int got_ltc = FALSE; /* We have gotten the local tty chars */ | |
27 int has_hit = FALSE; /* Has a "hit" message pending in msg */ | |
28 int in_shell = FALSE; /* True if executing a shell */ | |
29 int inv_describe = TRUE; /* Say which way items are being used */ | |
30 int jump = FALSE; /* Show running as series of jumps */ | |
31 int kamikaze = FALSE; /* to_death really to DEATH */ | |
32 int lower_msg = FALSE; /* Messages should start w/lower case */ | |
33 int move_on = FALSE; /* Next move shouldn't pick up items */ | |
34 int msg_esc = FALSE; /* Check for ESC from msg's --More-- */ | |
35 int passgo = FALSE; /* Follow passages */ | |
36 int playing = TRUE; /* True until he quits */ | |
37 int q_comm = FALSE; /* Are we executing a 'Q' command? */ | |
38 int running = FALSE; /* True if player is running */ | |
39 int save_msg = TRUE; /* Remember last msg */ | |
40 int see_floor = TRUE; /* Show the lamp illuminated floor */ | |
41 int stat_msg = FALSE; /* Should status() print as a msg() */ | |
42 int terse = FALSE; /* True if we should be short */ | |
43 int to_death = FALSE; /* Fighting is to the death! */ | |
44 int tombstone = TRUE; /* Print out tombstone at end */ | |
45 #ifdef MASTER | |
46 int wizard = FALSE; /* True if allows wizard commands */ | |
47 #endif | |
48 int pack_used[26] = { /* Is the character used in the pack? */ | |
49 FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, | |
50 FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, | |
51 FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE | |
52 }; | |
53 | |
54 int dir_ch; /* Direction from last get_dir() call */ | |
55 char file_name[MAXSTR]; /* Save file name */ | |
56 char huh[MAXSTR]; /* The last message printed */ | |
57 const char *p_colors[MAXPOTIONS]; /* Colors of the potions */ | |
58 char prbuf[2*MAXSTR]; /* buffer for sprintfs */ | |
59 const char *r_stones[MAXRINGS]; /* Stone settings of the rings */ | |
60 int runch; /* Direction player is running */ | |
61 char *s_names[MAXSCROLLS]; /* Names of the scrolls */ | |
62 int take; /* Thing she is taking */ | |
63 char whoami[MAXSTR]; /* Name of player */ | |
64 const char *ws_made[MAXSTICKS]; /* What sticks are made of */ | |
65 char *ws_type[MAXSTICKS]; /* Is it a wand or a staff */ | |
66 int orig_dsusp; /* Original dsusp char */ | |
67 char fruit[MAXSTR] = /* Favorite fruit */ | |
68 { 's', 'l', 'i', 'm', 'e', '-', 'm', 'o', 'l', 'd', '\0' }; | |
69 char home[MAXSTR] = { '\0' }; /* User's home directory */ | |
70 const char *inv_t_name[] = { | |
71 "Overwrite", | |
72 "Slow", | |
73 "Clear" | |
74 }; | |
75 int l_last_comm = '\0'; /* Last last_comm */ | |
76 int l_last_dir = '\0'; /* Last last_dir */ | |
77 int last_comm = '\0'; /* Last command typed */ | |
78 int last_dir = '\0'; /* Last direction given */ | |
79 const char *tr_name[] = { /* Names of the traps */ | |
80 "a trapdoor", | |
81 "an arrow trap", | |
82 "a sleeping gas trap", | |
83 "a beartrap", | |
84 "a teleport trap", | |
85 "a poison dart trap", | |
86 "a rust trap", | |
87 "a mysterious trap" | |
88 }; | |
89 | |
90 | |
91 int n_objs; /* # items listed in inventory() call */ | |
92 int ntraps; /* Number of traps on this level */ | |
93 int hungry_state = 0; /* How hungry is he */ | |
94 int inpack = 0; /* Number of things in pack */ | |
95 int inv_type = 0; /* Type of inventory to use */ | |
96 int level = 1; /* What level she is on */ | |
97 int max_hit; /* Max damage done to her in to_death */ | |
98 int max_level; /* Deepest player has gone */ | |
99 int mpos = 0; /* Where cursor is on top line */ | |
100 int no_food = 0; /* Number of levels without food */ | |
101 const int a_class[MAXARMORS] = { /* Armor class for each armor type */ | |
102 8, /* LEATHER */ | |
103 7, /* RING_MAIL */ | |
104 7, /* STUDDED_LEATHER */ | |
105 6, /* SCALE_MAIL */ | |
106 5, /* CHAIN_MAIL */ | |
107 4, /* SPLINT_MAIL */ | |
108 4, /* BANDED_MAIL */ | |
109 3, /* PLATE_MAIL */ | |
110 }; | |
111 | |
112 int count = 0; /* Number of times to repeat command */ | |
113 FILE *scoreboard = NULL; /* File descriptor for score file */ | |
114 int food_left; /* Amount of food in hero's stomach */ | |
115 int lastscore = -1; /* Score before this turn */ | |
116 int no_command = 0; /* Number of turns asleep */ | |
117 int no_move = 0; /* Number of turns held in place */ | |
118 int purse = 0; /* How much gold he has */ | |
119 int quiet = 0; /* Number of quiet turns */ | |
120 int vf_hit = 0; /* Number of time flytrap has hit */ | |
121 | |
122 unsigned int dnum; /* Dungeon number */ | |
123 unsigned int seed; /* Random number seed */ | |
124 const int e_levels[] = { | |
125 10L, | |
126 20L, | |
127 40L, | |
128 80L, | |
129 160L, | |
130 320L, | |
131 640L, | |
132 1300L, | |
133 2600L, | |
134 5200L, | |
135 13000L, | |
136 26000L, | |
137 50000L, | |
138 100000L, | |
139 200000L, | |
140 400000L, | |
141 800000L, | |
142 2000000L, | |
143 4000000L, | |
144 8000000L, | |
145 0L | |
146 }; | |
147 | |
148 coord delta; /* Change indicated to get_dir() */ | |
149 coord oldpos; /* Position before last look() call */ | |
150 coord stairs; /* Location of staircase */ | |
151 | |
152 PLACE places[MAXLINES*MAXCOLS]; /* level map */ | |
153 | |
154 THING *cur_armor; /* What he is wearing */ | |
155 THING *cur_ring[2]; /* Which rings are being worn */ | |
156 THING *cur_weapon; /* Which weapon he is weilding */ | |
157 THING *l_last_pick = NULL; /* Last last_pick */ | |
158 THING *last_pick = NULL; /* Last object picked in get_item() */ | |
159 THING *lvl_obj = NULL; /* List of objects on this level */ | |
160 THING *mlist = NULL; /* List of monsters on the level */ | |
161 THING player; /* His stats */ | |
162 /* restart of game */ | |
163 | |
164 WINDOW *hw = NULL; /* used as a scratch window */ | |
165 | |
166 #define INIT_STATS { 16, 0, 1, 10, 12, "1x4", 12 } | |
167 | |
168 struct stats max_stats = INIT_STATS; /* The maximum for the player */ | |
169 | |
170 struct room *oldrp; /* Roomin(&oldpos) */ | |
171 struct room rooms[MAXROOMS]; /* One for each room -- A level */ | |
172 struct room passages[MAXPASS] = /* One for each passage */ | |
173 { | |
174 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
175 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
176 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
177 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
178 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
179 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
180 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
181 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
182 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
183 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
184 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} }, | |
185 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, {{0,0}} } | |
186 }; | |
187 | |
188 #define ___ 1 | |
189 #define XX 10 | |
190 struct monster monsters[26] = | |
191 { | |
192 /* Name CARRY FLAG str, exp, lvl, amr, hpt, dmg */ | |
193 { "aquator", 0, ISMEAN, { XX, 20, 5, 2, ___, "0x0/0x0" } }, | |
194 { "bat", 0, ISFLY, { XX, 1, 1, 3, ___, "1x2" } }, | |
195 { "centaur", 15, 0, { XX, 17, 4, 4, ___, "1x2/1x5/1x5" } }, | |
196 { "dragon", 100, ISMEAN, { XX,5000, 10, -1, ___, "1x8/1x8/3x10" } }, | |
197 { "emu", 0, ISMEAN, { XX, 2, 1, 7, ___, "1x2" } }, | |
198 { "venus flytrap", 0, ISMEAN, { XX, 80, 8, 3, ___, "%%%x0" } }, | |
199 /* NOTE: the damage is %%% so that xstr won't merge this */ | |
200 /* string with others, since it is written on in the program */ | |
201 { "griffin", 20, ISMEAN|ISFLY|ISREGEN, { XX,2000, 13, 2, ___, "4x3/3x5" } }, | |
202 { "hobgoblin", 0, ISMEAN, { XX, 3, 1, 5, ___, "1x8" } }, | |
203 { "ice monster", 0, 0, { XX, 5, 1, 9, ___, "0x0" } }, | |
204 { "jabberwock", 70, 0, { XX,3000, 15, 6, ___, "2x12/2x4" } }, | |
205 { "kestrel", 0, ISMEAN|ISFLY, { XX, 1, 1, 7, ___, "1x4" } }, | |
206 { "leprechaun", 0, 0, { XX, 10, 3, 8, ___, "1x1" } }, | |
207 { "medusa", 40, ISMEAN, { XX,200, 8, 2, ___, "3x4/3x4/2x5" } }, | |
208 { "nymph", 100, 0, { XX, 37, 3, 9, ___, "0x0" } }, | |
209 { "orc", 15, ISGREED,{ XX, 5, 1, 6, ___, "1x8" } }, | |
210 { "phantom", 0, ISINVIS,{ XX,120, 8, 3, ___, "4x4" } }, | |
211 { "quagga", 0, ISMEAN, { XX, 15, 3, 3, ___, "1x5/1x5" } }, | |
212 { "rattlesnake", 0, ISMEAN, { XX, 9, 2, 3, ___, "1x6" } }, | |
213 { "snake", 0, ISMEAN, { XX, 2, 1, 5, ___, "1x3" } }, | |
214 { "troll", 50, ISREGEN|ISMEAN,{ XX, 120, 6, 4, ___, "1x8/1x8/2x6" } }, | |
215 { "black unicorn", 0, ISMEAN, { XX,190, 7, -2, ___, "1x9/1x9/2x9" } }, | |
216 { "vampire", 20, ISREGEN|ISMEAN,{ XX,350, 8, 1, ___, "1x10" } }, | |
217 { "wraith", 0, 0, { XX, 55, 5, 4, ___, "1x6" } }, | |
218 { "xeroc", 30, 0, { XX,100, 7, 7, ___, "4x4" } }, | |
219 { "yeti", 30, 0, { XX, 50, 4, 6, ___, "1x6/1x6" } }, | |
220 { "zombie", 0, ISMEAN, { XX, 6, 2, 8, ___, "1x8" } } | |
221 }; | |
222 #undef ___ | |
223 #undef XX | |
224 | |
225 struct obj_info things[NUMTHINGS] = { | |
226 { 0, 26 }, /* potion */ | |
227 { 0, 36 }, /* scroll */ | |
228 { 0, 16 }, /* food */ | |
229 { 0, 7 }, /* weapon */ | |
230 { 0, 7 }, /* armor */ | |
231 { 0, 4 }, /* ring */ | |
232 { 0, 4 }, /* stick */ | |
233 }; | |
234 | |
235 struct obj_info arm_info[MAXARMORS] = { | |
236 { "leather armor", 20, 20, NULL, FALSE }, | |
237 { "ring mail", 15, 25, NULL, FALSE }, | |
238 { "studded leather armor", 15, 20, NULL, FALSE }, | |
239 { "scale mail", 13, 30, NULL, FALSE }, | |
240 { "chain mail", 12, 75, NULL, FALSE }, | |
241 { "splint mail", 10, 80, NULL, FALSE }, | |
242 { "banded mail", 10, 90, NULL, FALSE }, | |
243 { "plate mail", 5, 150, NULL, FALSE }, | |
244 }; | |
245 struct obj_info pot_info[MAXPOTIONS] = { | |
246 { "confusion", 7, 5, NULL, FALSE }, | |
247 { "hallucination", 8, 5, NULL, FALSE }, | |
248 { "poison", 8, 5, NULL, FALSE }, | |
249 { "gain strength", 13, 150, NULL, FALSE }, | |
250 { "see invisible", 3, 100, NULL, FALSE }, | |
251 { "healing", 13, 130, NULL, FALSE }, | |
252 { "monster detection", 6, 130, NULL, FALSE }, | |
253 { "magic detection", 6, 105, NULL, FALSE }, | |
254 { "raise level", 2, 250, NULL, FALSE }, | |
255 { "extra healing", 5, 200, NULL, FALSE }, | |
256 { "haste self", 5, 190, NULL, FALSE }, | |
257 { "restore strength", 13, 130, NULL, FALSE }, | |
258 { "blindness", 5, 5, NULL, FALSE }, | |
259 { "levitation", 6, 75, NULL, FALSE }, | |
260 }; | |
261 struct obj_info ring_info[MAXRINGS] = { | |
262 { "protection", 9, 400, NULL, FALSE }, | |
263 { "add strength", 9, 400, NULL, FALSE }, | |
264 { "sustain strength", 5, 280, NULL, FALSE }, | |
265 { "searching", 10, 420, NULL, FALSE }, | |
266 { "see invisible", 10, 310, NULL, FALSE }, | |
267 { "adornment", 1, 10, NULL, FALSE }, | |
268 { "aggravate monster", 10, 10, NULL, FALSE }, | |
269 { "dexterity", 8, 440, NULL, FALSE }, | |
270 { "increase damage", 8, 400, NULL, FALSE }, | |
271 { "regeneration", 4, 460, NULL, FALSE }, | |
272 { "slow digestion", 9, 240, NULL, FALSE }, | |
273 { "teleportation", 5, 30, NULL, FALSE }, | |
274 { "stealth", 7, 470, NULL, FALSE }, | |
275 { "maintain armor", 5, 380, NULL, FALSE }, | |
276 }; | |
277 struct obj_info scr_info[MAXSCROLLS] = { | |
278 { "monster confusion", 7, 140, NULL, FALSE }, | |
279 { "magic mapping", 4, 150, NULL, FALSE }, | |
280 { "hold monster", 2, 180, NULL, FALSE }, | |
281 { "sleep", 3, 5, NULL, FALSE }, | |
282 { "enchant armor", 7, 160, NULL, FALSE }, | |
283 { "identify potion", 10, 80, NULL, FALSE }, | |
284 { "identify scroll", 10, 80, NULL, FALSE }, | |
285 { "identify weapon", 6, 80, NULL, FALSE }, | |
286 { "identify armor", 7, 100, NULL, FALSE }, | |
287 { "identify ring, wand or staff", 10, 115, NULL, FALSE }, | |
288 { "scare monster", 3, 200, NULL, FALSE }, | |
289 { "food detection", 2, 60, NULL, FALSE }, | |
290 { "teleportation", 5, 165, NULL, FALSE }, | |
291 { "enchant weapon", 8, 150, NULL, FALSE }, | |
292 { "create monster", 4, 75, NULL, FALSE }, | |
293 { "remove curse", 7, 105, NULL, FALSE }, | |
294 { "aggravate monsters", 3, 20, NULL, FALSE }, | |
295 { "protect armor", 2, 250, NULL, FALSE }, | |
296 }; | |
297 struct obj_info weap_info[MAXWEAPONS + 1] = { | |
298 { "mace", 11, 8, NULL, FALSE }, | |
299 { "long sword", 11, 15, NULL, FALSE }, | |
300 { "short bow", 12, 15, NULL, FALSE }, | |
301 { "arrow", 12, 1, NULL, FALSE }, | |
302 { "dagger", 8, 3, NULL, FALSE }, | |
303 { "two handed sword", 10, 75, NULL, FALSE }, | |
304 { "dart", 12, 2, NULL, FALSE }, | |
305 { "shuriken", 12, 5, NULL, FALSE }, | |
306 { "spear", 12, 5, NULL, FALSE }, | |
307 { NULL, 0 }, /* DO NOT REMOVE: fake entry for dragon's breath */ | |
308 }; | |
309 struct obj_info ws_info[MAXSTICKS] = { | |
310 { "light", 12, 250, NULL, FALSE }, | |
311 { "invisibility", 6, 5, NULL, FALSE }, | |
312 { "lightning", 3, 330, NULL, FALSE }, | |
313 { "fire", 3, 330, NULL, FALSE }, | |
314 { "cold", 3, 330, NULL, FALSE }, | |
315 { "polymorph", 15, 310, NULL, FALSE }, | |
316 { "magic missile", 10, 170, NULL, FALSE }, | |
317 { "haste monster", 10, 5, NULL, FALSE }, | |
318 { "slow monster", 11, 350, NULL, FALSE }, | |
319 { "drain life", 9, 300, NULL, FALSE }, | |
320 { "nothing", 1, 5, NULL, FALSE }, | |
321 { "teleport away", 6, 340, NULL, FALSE }, | |
322 { "teleport to", 6, 50, NULL, FALSE }, | |
323 { "cancellation", 5, 280, NULL, FALSE }, | |
324 }; | |
325 | |
326 const struct h_list helpstr[] = { | |
327 {'?', " prints help", TRUE}, | |
328 {'/', " identify object", TRUE}, | |
329 {'h', " left", TRUE}, | |
330 {'j', " down", TRUE}, | |
331 {'k', " up", TRUE}, | |
332 {'l', " right", TRUE}, | |
333 {'y', " up & left", TRUE}, | |
334 {'u', " up & right", TRUE}, | |
335 {'b', " down & left", TRUE}, | |
336 {'n', " down & right", TRUE}, | |
337 {'H', " run left", FALSE}, | |