Mercurial > hg > early-roguelike
comparison urogue/init.c @ 256:c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
author | John "Elwin" Edwards |
---|---|
date | Tue, 31 Jan 2017 19:56:04 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
253:d9badb9c0179 | 256:c495a4f288c6 |
---|---|
1 /* | |
2 init.c - global variable initializaton | |
3 | |
4 UltraRogue: The Ultimate Adventure in the Dungeons of Doom | |
5 Copyright (C) 1985, 1986, 1992, 1993, 1995 Herb Chong | |
6 All rights reserved. | |
7 | |
8 Based on "Advanced Rogue" | |
9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka | |
10 All rights reserved. | |
11 | |
12 Based on "Rogue: Exploring the Dungeons of Doom" | |
13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | |
14 All rights reserved. | |
15 | |
16 See the file LICENSE.TXT for full copyright and licensing information. | |
17 */ | |
18 | |
19 /* | |
20 Notes | |
21 | |
22 Need to add ring of maintain armor (same as ring of prot, armor only) | |
23 Resplit file into one just for data, one just for functions | |
24 */ | |
25 | |
26 #define _ALL_SOURCE /* Need to remove need for this AIXism */ | |
27 | |
28 #include <string.h> | |
29 #include <stdlib.h> | |
30 #include <ctype.h> | |
31 #include "rogue.h" | |
32 | |
33 static char *rainbow[] = | |
34 { | |
35 "Red", "Blue", "Green", "Yellow", | |
36 "Black", "Brown", "Orange", "Pink", | |
37 "Purple", "Grey", "White", "Silver", | |
38 "Gold", "Violet", "Clear", "Vermilion", | |
39 "Ecru", "Turquoise", "Magenta", "Amber", | |
40 "Topaz", "Plaid", "Tan", "Tangerine", | |
41 "Aquamarine", "Scarlet", "Khaki", "Crimson", | |
42 "Indigo", "Beige", "Lavender", "Saffron" | |
43 }; | |
44 | |
45 #define NCOLORS (sizeof rainbow / sizeof (char *)) | |
46 | |
47 static char *sylls[] = | |
48 { | |
49 "a", "ab", "ag", "aks", "ala", "an", "ankh", "app", "arg", "arze", | |
50 "ash", "ban", "bar", "bat", "bek", "bie", "bin", "bit", "bjor", | |
51 "blu", "bot", "bu", "byt", "comp", "con", "cos", "cre", "dalf", | |
52 "dan", "den", "do", "e", "eep", "el", "eng", "er", "ere", "erk", | |
53 "esh", "evs", "fa", "fid", "for", "fri", "fu", "gan", "gar", | |
54 "glen", "gop", "gre", "ha", "he", "hyd", "i", "ing", "ion", "ip", | |
55 "ish", "it", "ite", "iv", "jo", "kho", "kli", "klis", "la", "lech", | |
56 "man", "mar", "me", "mi", "mic", "mik", "mon", "mung", "mur", | |
57 "nej", "nelg", "nep", "ner", "nes", "nes", "nih", "nin", "o", "od", | |
58 "ood", "org", "orn", "ox", "oxy", "pay", "pet", "ple", "plu", "po", | |
59 "pot", "prok", "re", "rea", "rhov", "ri", "ro", "rog", "rok", "rol", | |
60 "sa", "san", "sat", "see", "sef", "seh", "shu", "ski", "sna", | |
61 "sne", "snik", "sno", "so", "sol", "sri", "sta", "sun", "ta", | |
62 "tab", "tem", "ther", "ti", "tox", "trol", "tue", "turs", "u", | |
63 "ulk", "um", "un", "uni", "ur", "val", "viv", "vly", "vom", "wah", | |
64 "wed", "werg", "wex", "whon", "wun", "xo", "y", "yot", "yu", | |
65 "zant", "zap", "zeb", "zim", "zok", "zon", "zum" | |
66 }; | |
67 | |
68 static char *stones[] = | |
69 { | |
70 "Agate", "Alexandrite", "Amethyst", | |
71 "Azurite", "Carnelian", "Chrysoberyl", | |
72 "Chrysoprase", "Citrine", "Diamond", | |
73 "Emerald", "Garnet", "Hematite", | |
74 "Jacinth", "Jade", "Kryptonite", | |
75 "Lapus lazuli", "Malachite", "Moonstone", | |
76 "Obsidian", "Olivine", "Onyx", | |
77 "Opal", "Pearl", "Peridot", | |
78 "Quartz", "Rhodochrosite", "Ruby", | |
79 "Sapphire", "Sardonyx", "Serpentine", | |
80 "Spinel", "Tiger eye", "Topaz", | |
81 "Tourmaline", "Turquoise" | |
82 }; | |
83 | |
84 #define NSTONES (sizeof stones / sizeof (char *)) | |
85 | |
86 static char *wood[] = | |
87 { | |
88 "Avocado wood", "Balsa", "Banyan", "Birch", | |
89 "Cedar", "Cherry", "Cinnibar", "Dogwood", | |
90 "Driftwood", "Ebony", "Eucalyptus", "Hemlock", | |
91 "Ironwood", "Mahogany", "Manzanita", "Maple", | |
92 "Oak", "Pine", "Redwood", "Rosewood", | |
93 "Teak", "Walnut", "Zebra wood", "Persimmon wood" | |
94 }; | |
95 | |
96 #define NWOOD (sizeof wood / sizeof (char *)) | |
97 | |
98 static char *metal[] = | |
99 { | |
100 "Aluminium", "Bone", "Brass", "Bronze", | |
101 "Copper", "Chromium", "Iron", "Lead", | |
102 "Magnesium", "Pewter", "Platinum", "Steel", | |
103 "Tin", "Titanium", "Zinc", "Carbon", | |
104 "Plastic", "Glass", "Ice", "Chocolate", | |
105 "Gold", "Silver", "Invisible" | |
106 }; | |
107 | |
108 #define NMETAL (sizeof metal / sizeof (char *)) | |
109 | |
110 const char *monstern = "monster"; | |
111 char *spacemsg = "--Press SPACE to continue--"; | |
112 char *morestr = "--More--"; | |
113 char *retstr = "[Press RETURN to continue]"; | |
114 | |
115 /* 15 named levels */ | |
116 | |
117 const char *cnames[C_NOTSET][15] = | |
118 { | |
119 { "Veteran", "Warrior", | |
120 "Swordsman", "Hero", /* Fighter */ | |
121 "Swashbuckler", "Myrmidon", | |
122 "Champion", "Superhero", | |
123 "Lord", "Lord", | |
124 "Lord", "Lord", | |
125 "Lord", "Lord", | |
126 "Lord" | |
127 }, | |
128 | |
129 { "Gallant", "Keeper", | |
130 "Protector", "Defender", /* Paladin */ | |
131 "Warder", "Guardian", | |
132 "Chevalier", "Justiciar", | |
133 "Paladin", "Paladin", | |
134 "Paladin", "Paladin", | |
135 "Paladin", "Paladin", | |
136 "Paladin" | |
137 }, | |
138 | |
139 { "Runner", "Strider", | |
140 "Scout", "Courser", /* Ranger */ | |
141 "Tracker", "Guide", | |
142 "Pathfinder", "Ranger", | |
143 "Ranger Knight", "Ranger Lord", | |
144 "Ranger Lord", "Ranger Lord", | |
145 "Ranger Lord", "Ranger Lord", | |
146 "Ranger Lord" | |
147 }, | |
148 | |
149 { "Acolyte", "Adept", | |
150 "Priest", "Curate", /* Cleric */ | |
151 "Prefect", "Canon", | |
152 "Lama", "Patriarch", | |
153 "High Priest", "High Priest", | |
154 "High Priest", "High Priest", | |
155 "High Priest", "High Priest", | |
156 "High Priest" | |
157 }, | |
158 | |
159 { "Aspirant", "Ovate", /* Druid */ | |
160 "Initiate of the 1st Circle", "Initiate of the 2nd Circle", | |
161 "Initiate of the 3rd Circle", "Initiate of the 4th Circle", | |
162 "Initiate of the 5th Circle", "Initiate of the 6th Circle", | |
163 "Initiate of the 7th Circle", "Initiate of the 8th Circle", | |
164 "Initiate of the 9th Circle", "Druid", | |
165 "Archdruid", "The Great Druid", | |
166 "The Grand Druid" | |
167 }, | |
168 | |
169 { "Prestidigitator", "Evoker", | |
170 "Conjurer", "Theurgist", /* Magic User */ | |
171 "Thaumaturgist", "Magician", | |
172 "Enchanter", "Warlock", | |
173 "Sorcerer", "Necromancer", | |
174 "Wizard", "Wizard", | |
175 "Wizard", "Wizard", | |
176 "Wizard" | |
177 }, | |
178 | |
179 { "Prestidigitator", "Minor Trickster", | |
180 "Trickster", "Master Trickster", /* Illusionist */ | |
181 "Cabalist", "Visionist", | |
182 "Phantasmist", "Apparitionist", | |
183 "Spellbinder", "Illusionist", | |
184 "Illusionist", "Illusionist", | |
185 "Illusionist", "Illusionist", | |
186 "Illusionist" | |
187 }, | |
188 | |
189 { "Rogue", "Footpad", | |
190 "Cutpurse", "Robber", /* Thief */ | |
191 "Burglar", "Filcher", | |
192 "Sharper", "Magsman", | |
193 "Thief", "Master Thief", | |
194 "Master Thief", "Master Thief", | |
195 "Master Thief", "Master Thief", | |
196 "Master Thief" | |
197 }, | |
198 | |
199 { "Bravo", "Rutterkin", | |
200 "Waghalter", "Murderer", /* Assasin */ | |
201 "Thug", "Killer", | |
202 "Cutthroat", "Executioner", | |
203 "Assassin", "Expert Assassin", | |
204 "Senior Assassin", "Chief Assassin", | |
205 "Prime Assassin", "Guildmaster Assassin", | |
206 "Grandfather of Assassins" | |
207 }, | |
208 | |
209 { "Ninja", "Ninja", | |
210 "Ninja", "Ninja", /* Ninja */ | |
211 "Ninja", "Ninja", | |
212 "Ninja", "Ninja", | |
213 "Ninja", "Ninja", | |
214 "Ninja", "Ninja", | |
215 "Ninja", "Ninja", | |
216 "Ninja" | |
217 } | |
218 }; | |
219 | |
220 const struct h_list helpstr[] = | |
221 { | |
222 { '?', " prints help" }, | |
223 { '/', " identify object" }, | |
224 { 'h', " left" }, | |
225 { 'j', " down" }, | |
226 { 'k', " up" }, | |
227 { 'l', " right" }, | |
228 { 'y', " up & left" }, | |
229 { 'u', " up & right" }, | |
230 { 'b', " down & left" }, | |
231 { 'n', " down & right" }, | |
232 { '<', "SHIFT><dir> run that way" }, | |
233 { 'm', "<dir> move onto without picking up" }, | |
234 { 't', "<dir> throw something" }, | |
235 { 'z', "<dir> zap a wand or staff" }, | |
236 { '>', " go down a staircase" }, | |
237 { 's', " search for trap/secret door" }, | |
238 { '.', " rest for a while" }, | |
239 { ',', " pick up an object" }, | |
240 { 'i', " inventory all items" }, | |
241 { 'I', " inventory type of item" }, | |
242 { 'q', " quaff potion" }, | |
243 { 'r', " read paper" }, | |
244 { 'e', " eat food" }, | |
245 { 'w', " wield a weapon" }, | |
246 { 'W', " wear armor" }, | |
247 { 'T', " take armor off" }, | |
248 { 'P', " put on ring" }, | |
249 { 'R', " remove ring" }, | |
250 { 'A', " activate/apply an artifact" }, | |
251 { 'd', " drop object" }, | |
252 { 'C', " call object (generic)" }, | |
253 { 'M', " mark object (specific)" }, | |
254 { 'o', " examine/set options" }, | |
255 { 'c', " cast a spell/say a prayer" }, | |
256 { 'p', " pray for help (risky)" }, | |
257 { 'a', " affect the undead" }, | |
258 { '^', " set a trap" }, | |
259 { 'D', " dip something (into a pool)" }, | |
260 { 20, "<dir> take (steal) from (direction)" }, /* ctrl-t */ | |
261 { 18, " redraw screen" }, /* ctrl-r */ | |
262 { 16, " back up to 10 previous messages" }, /* ctrl-p */ | |
263 { ESCAPE, " cancel command" }, | |
264 { 'v', " print program version number" }, | |
265 { 'S', " save game" }, | |
266 { 'Q', " quit" }, | |
267 { '=', " listen for monsters" }, | |
268 { 'f', "<dir> fight monster" }, | |
269 { 'F', "<dir> fight monster to the death" }, | |
270 | |
271 /* Wizard commands. Identified by (h_ch != 0 && h_desc == 0). */ | |
272 | |
273 {'-', 0 }, | |
274 { 23, " enter wizard mode" }, /* ctrl-w */ | |
275 { 23, "v toggle wizard verbose mode" }, | |
276 { 23, "e exit wizard mode" }, | |
277 { 23, "r random number check" }, | |
278 { 23, "s system statistics" }, | |
279 { 23, "F food statistics" }, | |
280 { 23, "f floor map" }, | |
281 { 23, "m see monster" }, | |
282 { 23, "M create monster" }, | |
283 { 23, "c create item" }, | |
284 { 23, "i inventory level" }, | |
285 { 23, "I identify item" }, | |
286 { 23, "t random teleport" }, | |
287 { 23, "g goto level" }, | |
288 { 23, "C charge item" }, | |
289 { 23, "w print worth of object" }, | |
290 { 23, "o improve stats and pack" }, | |
291 { 0, 0 } | |
292 }; | |
293 | |
294 struct magic_item things[] = | |
295 { | |
296 {"potion", "POTION", 250, 5}, /* potion */ | |
297 {"scroll", "SCROLL", 260, 30},/* scroll */ | |
298 {"ring", "RING", 70, 5}, /* ring */ | |
299 {"stick", "STICK", 60, 0}, /* stick */ | |
300 {"food", "FOOD", 210, 7}, /* food */ | |
301 {"weapon", "WEAPON", 60, 0}, /* weapon */ | |
302 {"armor", "ARMOR", 90, 0}, /* armor */ | |
303 {"artifact","ARTIFACT", 0, 0} /* special artifacts*/ | |
304 }; | |
305 | |
306 int numthings = NUMTHINGS; | |
307 | |
308 struct magic_item s_magic[] = | |
309 { | |
310 {"monster confusion", "CON", 50, 125, 0, 0 }, | |
311 {"magic mapping", "MAP", 45, 150, 20, 10 }, | |
312 {"light", "WATT", 0, 0, 0, 0 }, | |
313 {"hold monster", "HOLD", 25, 200, 33, 10 }, | |
314 {"sleep", "SNOOZE", 23, 50, 20, 10 }, | |
315 {"enchantment", "ENCHANT", 110,400, 15, 10 }, | |
316 {"identify", "ID", 150,50, 0, 15 }, | |
317 {"scare monster", "SCARE", 35, 250, 27, 21 }, | |
318 {"detect gold", "GOLD", 0, 0, 0, 0 }, | |
319 {"teleportation", "TELEP", 50, 165, 10, 20 }, | |
320 {"create monster", "CREATE", 25, 75, 30, 0 }, |