Mercurial > hg > early-roguelike
comparison rogue4/extern.c @ 12:9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
author | edwarj4 |
---|---|
date | Sat, 24 Oct 2009 16:52:52 +0000 |
parents | |
children | 63b9fd7d70ce |
comparison
equal
deleted
inserted
replaced
11:949d558c2162 | 12:9535a08ddc39 |
---|---|
1 /* | |
2 * global variable initializaton | |
3 * | |
4 * @(#)extern.c 4.32 (Berkeley) 4/1/82 | |
5 * | |
6 * Rogue: Exploring the Dungeons of Doom | |
7 * Copyright (C) 1980, 1981, 1982 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 #include <curses.h> | |
14 #include "rogue.h" | |
15 | |
16 bool after; /* True if we want after daemons */ | |
17 bool noscore; /* Was a wizard sometime */ | |
18 bool s_know[MAXSCROLLS]; /* Does he know what a scroll does */ | |
19 bool p_know[MAXPOTIONS]; /* Does he know what a potion does */ | |
20 bool r_know[MAXRINGS]; /* Does he know what a ring does */ | |
21 bool ws_know[MAXSTICKS]; /* Does he know what a stick does */ | |
22 bool amulet = FALSE; /* He found the amulet */ | |
23 bool askme = FALSE; /* Ask about unidentified things */ | |
24 bool door_stop = FALSE; /* Stop running when we pass a door */ | |
25 bool fight_flush = FALSE; /* True if toilet input */ | |
26 bool firstmove = FALSE; /* First move after setting door_stop */ | |
27 bool in_shell = FALSE; /* True if executing a shell */ | |
28 bool jump = FALSE; /* Show running as series of jumps */ | |
29 bool passgo = FALSE; /* Follow passages */ | |
30 bool playing = TRUE; /* True until he quits */ | |
31 bool running = FALSE; /* True if player is running */ | |
32 bool save_msg = TRUE; /* Remember last msg */ | |
33 bool slow_invent = FALSE; /* Inventory one line at a time */ | |
34 bool terse = FALSE; /* True if we should be short */ | |
35 #ifdef WIZARD | |
36 bool wizard = FALSE; /* True if allows wizard commands */ | |
37 #endif | |
38 | |
39 char take; /* Thing the rogue is taking */ | |
40 char prbuf[MAXSTR]; /* Buffer for sprintfs */ | |
41 char outbuf[BUFSIZ]; /* Output buffer for stdout */ | |
42 char runch; /* Direction player is running */ | |
43 char *s_names[MAXSCROLLS]; /* Names of the scrolls */ | |
44 const char *p_colors[MAXPOTIONS]; /* Colors of the potions */ | |
45 const char *r_stones[MAXRINGS]; /* Stone settings of the rings */ | |
46 const char *w_names[MAXWEAPONS + 1] = { /* Names of the various weapons */ | |
47 "mace", | |
48 "long sword", | |
49 "short bow", | |
50 "arrow", | |
51 "dagger", | |
52 "two handed sword", | |
53 "dart", | |
54 "crossbow", | |
55 "crossbow bolt", | |
56 "spear", | |
57 NULL /* fake entry for dragon's breath */ | |
58 }; | |
59 const char *a_names[MAXARMORS] = { /* Names of armor types */ | |
60 "leather armor", | |
61 "ring mail", | |
62 "studded leather armor", | |
63 "scale mail", | |
64 "chain mail", | |
65 "splint mail", | |
66 "banded mail", | |
67 "plate mail", | |
68 }; | |
69 const char *ws_made[MAXSTICKS]; /* What sticks are made of */ | |
70 char *release; /* Release number of rogue */ | |
71 char whoami[MAXSTR]; /* Name of player */ | |
72 char fruit[MAXSTR]; /* Favorite fruit */ | |
73 char huh[MAXSTR]; /* The last message printed */ | |
74 char *s_guess[MAXSCROLLS]; /* Players guess at what scroll is */ | |
75 char *p_guess[MAXPOTIONS]; /* Players guess at what potion is */ | |
76 char *r_guess[MAXRINGS]; /* Players guess at what ring is */ | |
77 char *ws_guess[MAXSTICKS]; /* Players guess at what wand is */ | |
78 char *ws_type[MAXSTICKS]; /* Is it a wand or a staff */ | |
79 char file_name[MAXSTR]; /* Save file name */ | |
80 char home[MAXSTR]; /* User's home directory */ | |
81 char _level[MAXLINES*MAXCOLS]; /* Level map */ | |
82 char _flags[MAXLINES*MAXCOLS]; /* Flags for each space on the map */ | |
83 | |
84 int max_level; /* Deepest player has gone */ | |
85 int ntraps; /* Number of traps on this level */ | |
86 int dnum; /* Dungeon number */ | |
87 int level = 1; /* What level rogue is on */ | |
88 int purse = 0; /* How much gold the rogue has */ | |
89 int mpos = 0; /* Where cursor is on top line */ | |
90 int no_move = 0; /* Number of turns held in place */ | |
91 int no_command = 0; /* Number of turns asleep */ | |
92 int inpack = 0; /* Number of things in pack */ | |
93 int total = 0; /* Total dynamic memory bytes */ | |
94 int lastscore = -1; /* Score before this turn */ | |
95 int no_food = 0; /* Number of levels without food */ | |
96 int count = 0; /* Number of times to repeat command */ | |
97 int fung_hit = 0; /* Number of time fungi has hit */ | |
98 int quiet = 0; /* Number of quiet turns */ | |
99 int food_left; /* Amount of food in hero's stomach */ | |
100 int group = 2; /* Current group number */ | |
101 int hungry_state = 0; /* How hungry is he */ | |
102 int fd; /* File descriptor for score file */ | |
103 int a_chances[MAXARMORS] = { /* Chance for each armor type */ | |
104 20, | |
105 35, | |
106 50, | |
107 63, | |
108 75, | |
109 85, | |
110 95, | |
111 100 | |
112 }; | |
113 int a_class[MAXARMORS] = { /* Armor class for each armor type */ | |
114 8, | |
115 7, | |
116 7, | |
117 6, | |
118 5, | |
119 4, | |
120 4, | |
121 3, | |
122 }; | |
123 | |
124 long seed; /* Random number seed */ | |
125 | |
126 coord oldpos; /* Position before last look() call */ | |
127 coord delta; /* Change indicated to get_dir() */ | |
128 | |
129 THING player; /* The rogue */ | |
130 THING *cur_armor; /* What a well dresssed rogue wears */ | |
131 THING *cur_weapon; /* Which weapon he is weilding */ | |
132 THING *cur_ring[2]; /* Which rings are being worn */ | |
133 THING *lvl_obj = NULL; /* List of objects on this level */ | |
134 THING *mlist = NULL; /* List of monsters on the level */ | |
135 THING *_monst[MAXLINES*MAXCOLS]; /* Pointers for monsters at each spot */ | |
136 | |
137 WINDOW *hw; /* Used as a scratch window */ | |
138 | |
139 #define INIT_STATS { 16, 0, 1, 10, 12, "1d4", 12 } | |
140 | |
141 struct stats max_stats = INIT_STATS; /* The maximum for the player */ | |
142 | |
143 struct room *oldrp; /* Roomin(&oldpos) */ | |
144 struct room rooms[MAXROOMS]; /* One for each room -- A level */ | |
145 struct room passages[MAXPASS] = /* One for each passage */ | |
146 { | |
147 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
148 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
149 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
150 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
151 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
152 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
153 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
154 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
155 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
156 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
157 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, | |
158 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 } | |
159 }; | |
160 | |
161 #define ___ 1 | |
162 #define XX 10 | |
163 struct monster monsters[26] = | |
164 { | |
165 /* Name CARRY FLAG str, exp, lvl, amr, hpt, dmg */ | |
166 { "giant ant", 0, ISMEAN, { XX, 9, 2, 3, ___, "1d6" } }, | |
167 { "bat", 0, 0, { XX, 1, 1, 3, ___, "1d2" } }, | |
168 { "centaur", 15, 0, { XX, 15, 4, 4, ___, "1d6/1d6" } }, | |
169 { "dragon", 100, ISMEAN, { XX,6800, 10, -1, ___, "1d8/1d8/3d10" } }, | |
170 { "floating eye",0, 0, { XX, 5, 1, 9, ___, "0d0" } }, | |
171 /* NOTE: the damage is %%% so that xstr won't merge this */ | |
172 /* string with others, since it is written on in the program */ | |
173 { "violet fungi",0, ISMEAN, { XX, 80, 8, 3, ___, "%%%d0" } }, | |
174 { "gnome", 10, 0, { XX, 7, 1, 5, ___, "1d6" } }, | |
175 { "hobgoblin", 0, ISMEAN, { XX, 3, 1, 5, ___, "1d8" } }, | |
176 { "invisible stalker",0,ISINVIS,{ XX,120, 8, 3, ___, "4d4" } }, | |
177 { "jackal", 0, ISMEAN, { XX, 2, 1, 7, ___, "1d2" } }, | |
178 { "kobold", 0, ISMEAN, { XX, 1, 1, 7, ___, "1d4" } }, | |
179 { "leprechaun", 0, 0, { XX, 10, 3, 8, ___, "1d1" } }, | |
180 { "mimic", 30, 0, { XX,100, 7, 7, ___, "3d4" } }, | |
181 { "nymph", 100, 0, { XX, 37, 3, 9, ___, "0d0" } }, | |
182 { "orc", 15, ISGREED,{ XX, 5, 1, 6, ___, "1d8" } }, | |
183 { "purple worm", 70, 0, { XX,4000, 15, 6, ___, "2d12/2d4" } }, | |
184 { "quasit", 30, ISMEAN, { XX, 32, 3, 2, ___, "1d2/1d2/1d4" } }, | |
185 { "rust monster",0, ISMEAN, { XX, 20, 5, 2, ___, "0d0/0d0" } }, | |
186 { "snake", 0, ISMEAN, { XX, 2, 1, 5, ___, "1d3" } }, | |
187 { "troll", 50, ISREGEN|ISMEAN,{ XX, 120, 6, 4, ___, "1d8/1d8/2d6" } }, | |
188 { "umber hulk", 40, ISMEAN, { XX,200, 8, 2, ___, "3d4/3d4/2d5" } }, | |
189 { "vampire", 20, ISREGEN|ISMEAN,{ XX,350, 8, 1, ___, "1d10" } }, | |
190 { "wraith", 0, 0, { XX, 55, 5, 4, ___, "1d6" } }, | |
191 { "xorn", 0, ISMEAN, { XX,190, 7, -2, ___, "1d3/1d3/1d3/4d6" } }, | |
192 { "yeti", 30, 0, { XX, 50, 4, 6, ___, "1d6/1d6" } }, | |
193 { "zombie", 0, ISMEAN, { XX, 6, 2, 8, ___, "1d8" } } | |
194 }; | |
195 #undef ___ | |
196 #undef XX | |
197 | |
198 struct magic_item things[NUMTHINGS] = { | |
199 { 0, 27 }, /* potion */ | |
200 { 0, 30 }, /* scroll */ | |
201 { 0, 17 }, /* food */ | |
202 { 0, 8 }, /* weapon */ | |
203 { 0, 8 }, /* armor */ | |
204 { 0, 5 }, /* ring */ | |
205 { 0, 5 }, /* stick */ | |
206 }; | |
207 | |
208 struct magic_item s_magic[MAXSCROLLS] = { | |
209 { "monster confusion", 8, 140 }, | |
210 { "magic mapping", 5, 150 }, | |
211 { "hold monster", 3, 180 }, | |
212 { "sleep", 5, 5 }, | |
213 { "enchant armor", 8, 160 }, | |
214 { "identify", 27, 100 }, | |
215 { "scare monster", 4, 200 }, | |
216 { "gold detection", 4, 50 }, | |
217 { "teleportation", 7, 165 }, | |
218 { "enchant weapon", 10, 150 }, | |
219 { "create monster", 5, 75 }, | |
220 { "remove curse", 8, 105 }, | |
221 { "aggravate monsters", 4, 20 }, | |
222 { "blank paper", 1, 5 }, | |
223 { "genocide", 1, 300 }, | |
224 }; | |
225 | |
226 struct magic_item p_magic[MAXPOTIONS] = { | |
227 { "confusion", 8, 5 }, | |
228 { "paralysis", 10, 5 }, | |
229 { "poison", 8, 5 }, | |
230 { "gain strength", 15, 150 }, | |
231 { "see invisible", 2, 100 }, | |
232 { "healing", 15, 130 }, | |
233 { "monster detection", 6, 130 }, | |
234 { "magic detection", 6, 105 }, | |
235 { "raise level", 2, 250 }, | |
236 { "extra healing", 5, 200 }, | |
237 { "haste self", 4, 190 }, | |
238 { "restore strength", 14, 130 }, | |
239 { "blindness", 4, 5 }, | |
240 { "thirst quenching", 1, 5 }, | |
241 }; | |
242 | |
243 struct magic_item r_magic[MAXRINGS] = { | |
244 { "protection", 9, 400 }, | |
245 { "add strength", 9, 400 }, | |
246 { "sustain strength", 5, 280 }, | |
247 { "searching", 10, 420 }, | |
248 { "see invisible", 10, 310 }, | |
249 { "adornment", 1, 10 }, | |
250 { "aggravate monster", 10, 10 }, | |
251 { "dexterity", 8, 440 }, | |
252 { "increase damage", 8, 400 }, | |
253 { "regeneration", 4, 460 }, | |
254 { "slow digestion", 9, 240 }, | |
255 { "teleportation", 5, 30 }, | |
256 { "stealth", 7, 470 }, | |
257 { "maintain armor", 5, 380 }, | |
258 }; | |
259 | |
260 struct magic_item ws_magic[MAXSTICKS] = { | |
261 { "light", 12, 250 }, | |
262 { "striking", 9, 75 }, | |
263 { "lightning", 3, 330 }, | |
264 { "fire", 3, 330 }, | |
265 { "cold", 3, 330 }, | |
266 { "polymorph", 15, 310 }, | |
267 { "magic missile", 10, 170 }, | |
268 { "haste monster", 9, 5 }, | |
269 { "slow monster", 11, 350 }, | |
270 { "drain life", 9, 300 }, | |
271 { "nothing", 1, 5 }, | |
272 { "teleport away", 5, 340 }, | |
273 { "teleport to", 5, 50 }, | |
274 { "cancellation", 5, 280 }, | |
275 }; | |
276 | |
277 struct h_list helpstr[] = { | |
278 '?', " prints help", | |
279 '/', " identify object", | |
280 'h', " left", | |
281 'j', " down", | |
282 'k', " up", | |
283 'l', " right", | |
284 'y', " up & left", | |
285 'u', " up & right", | |
286 'b', " down & left", | |
287 'n', " down & right", | |
288 'H', " run left", | |
289 'J', " run down", | |
290 'K', " run up", | |
291 'L', " run right", | |
292 'Y', " run up & left", | |
293 'U', " run up & right", | |
294 'B', " run down & left", | |
295 'N', " run down & right", | |
296 't', "<dir> throw something", | |
297 'f', "<dir> forward until find something", | |
298 'z', "<dir> zap a wand in a direction", | |
299 '^', "<dir> identify trap type", | |
300 's', " search for trap/secret door", | |
301 '>', " go down a staircase", | |
302 '<', " go up a staircase", | |
303 '.', " rest for a while", | |
304 'i', " inventory", | |
305 'I', " inventory single item", | |
306 'q', " quaff potion", | |
307 'r', " read paper", | |
308 'e', " eat food", | |
309 'w', " wield a weapon", | |
310 'W', " wear armor", | |
311 'T', " take armor off", | |
312 'P', " put on ring", | |
313 'R', " remove ring", | |
314 'd', " drop object", | |
315 'c', " call object", | |
316 'D', " recall what's been discovered", | |
317 'o', " examine/set options", | |
318 CTRL('L'), " redraw screen", | |
319 CTRL('R'), " repeat last message", | |
320 ESCAPE, " cancel command", | |
321 '!', " shell escape", | |
322 'S', " save game", | |
323 'Q', " quit", | |
324 0, 0 | |
325 }; |