annotate arogue7/init.c @ 219:f9ef86cf22b2

Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default.
author John "Elwin" Edwards
date Fri, 19 Feb 2016 21:02:28 -0500
parents b786053d2f37
children e52a8a7ad4c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
2 * init.c - global variable initializaton
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
3 *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
4 * Advanced Rogue
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
5 * Copyright (C) 1984, 1985, 1986 Michael Morgan, Ken Dalka and AT&T
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
6 * All rights reserved.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
7 *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
8 * Based on "Rogue: Exploring the Dungeons of Doom"
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
9 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
10 * All rights reserved.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
11 *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
12 * See the file LICENSE.TXT for full copyright and licensing information.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
13 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
14
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
15 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
16 * global variable initializaton
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
17 *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
18 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
19
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
20 #include "curses.h"
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
21 #include <ctype.h>
126
b786053d2f37 arogue7: add missing header includes.
John "Elwin" Edwards
parents: 125
diff changeset
22 #include <string.h>
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
23 #include "rogue.h"
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
24 #include "mach_dep.h"
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
25
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
26
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
27 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
28 * If there is any news, put it in a character string and assign it to
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
29 * rogue_news. Otherwise, assign NULL to rogue_news.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
30 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
31 static char *rogue_news = "You no longer fall into trading posts. They are \
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
32 now entered like going down the stairs.";
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
33
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
34 char *rainbow[] = {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
35
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
36 "amber", "aquamarine", "beige",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
37 "black", "blue", "brown",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
38 "clear", "crimson", "ecru",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
39 "gold", "green", "grey",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
40 "indigo", "khaki", "lavender",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
41 "magenta", "orange", "pink",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
42 "plaid", "purple", "red",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
43 "silver", "saffron", "scarlet",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
44 "tan", "tangerine", "topaz",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
45 "turquoise", "vermilion", "violet",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
46 "white", "yellow",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
47 };
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
48 #define NCOLORS (sizeof rainbow / sizeof(char *))
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
49 int cNCOLORS = NCOLORS;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
50
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
51 static char *sylls[] = {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
52 "a", "ab", "ag", "aks", "ala", "an", "ankh", "app", "arg", "arze",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
53 "ash", "ban", "bar", "bat", "bek", "bie", "bin", "bit", "bjor",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
54 "blu", "bot", "bu", "byt", "comp", "con", "cos", "cre", "dalf",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
55 "dan", "den", "do", "e", "eep", "el", "eng", "er", "ere", "erk",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
56 "esh", "evs", "fa", "fid", "for", "fri", "fu", "gan", "gar",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
57 "glen", "gop", "gre", "ha", "he", "hyd", "i", "ing", "ion", "ip",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
58 "ish", "it", "ite", "iv", "jo", "kho", "kli", "klis", "la", "lech",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
59 "man", "mar", "me", "mi", "mic", "mik", "mon", "mung", "mur",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
60 "nej", "nelg", "nep", "ner", "nes", "net", "nih", "nin", "o", "od",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
61 "ood", "org", "orn", "ox", "oxy", "pay", "pet", "ple", "plu", "po",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
62 "pot", "prok", "re", "rea", "rhov", "ri", "ro", "rog", "rok", "rol",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
63 "sa", "san", "sat", "see", "sef", "seh", "shu", "ski", "sna",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
64 "sne", "snik", "sno", "so", "sol", "sri", "sta", "sun", "ta",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
65 "tab", "tem", "ther", "ti", "tox", "trol", "tue", "turs", "u",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
66 "ulk", "um", "un", "uni", "ur", "val", "viv", "vly", "vom", "wah",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
67 "wed", "werg", "wex", "whon", "wun", "xo", "y", "yot", "yu",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
68 "zant", "zap", "zeb", "zim", "zok", "zon", "zum",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
69 };
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
70
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
71 char *stones[] = {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
72 "agate", "alexandrite", "amethyst",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
73 "azurite", "bloodstone", "cairngorm",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
74 "carnelian", "chalcedony", "chrysoberyl",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
75 "chrysolite", "chrysoprase", "citrine",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
76 "coral", "diamond", "emerald",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
77 "garnet", "heliotrope", "hematite",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
78 "hyacinth", "jacinth", "jade",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
79 "jargoon", "jasper", "kryptonite",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
80 "lapus lazuli", "malachite", "mocca stone",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
81 "moonstone", "obsidian", "olivine",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
82 "onyx", "opal", "pearl",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
83 "peridot", "quartz", "rhodochrosite",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
84 "rhodolite", "ruby", "sapphire",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
85 "sardonyx", "serpintine", "spinel",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
86 "tiger eye", "topaz", "tourmaline",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
87 "turquoise", "zircon",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
88 };
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
89 #define NSTONES (sizeof stones / sizeof(char *))
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
90 int cNSTONES = NSTONES;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
91
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
92 char *wood[] = {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
93 "avocado wood", "balsa", "banyan", "birch",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
94 "cedar", "cherry", "cinnibar", "dogwood",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
95 "driftwood", "ebony", "eucalyptus", "hemlock",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
96 "ironwood", "mahogany", "manzanita", "maple",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
97 "oak", "pine", "redwood", "rosewood",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
98 "teak", "walnut", "zebra wood", "persimmon wood",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
99 };
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
100 #define NWOOD (sizeof wood / sizeof(char *))
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
101 int cNWOOD = NWOOD;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
102
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
103 char *metal[] = {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
104 "aluminium", "bone", "brass", "bronze",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
105 "copper", "chromium", "iron", "lead",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
106 "magnesium", "pewter", "platinum", "silver",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
107 "steel", "tin", "titanium", "zinc",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
108 };
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
109 #define NMETAL (sizeof metal / sizeof(char *))
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
110 int cNMETAL = NMETAL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
111 #define MAX3(a,b,c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
112
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
113 static bool used[MAX3(NCOLORS, NSTONES, NWOOD)];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
114
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
115
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
116 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
117 * make sure all the percentages specified in the tables add up to the
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
118 * right amounts
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
119 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
120 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
121 badcheck(char *name, struct magic_item *magic, int bound)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
122 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
123 register struct magic_item *end;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
124
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
125 if (magic[bound - 1].mi_prob == 1000)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
126 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
127 printf("\nBad percentages for %s:\n", name);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
128 for (end = &magic[bound] ; magic < end ; magic++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
129 printf("%4d%% %s\n", magic->mi_prob, magic->mi_name);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
130 printf(retstr);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
131 fflush(stdout);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
132 while (getchar() != '\n')
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
133 continue;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
134 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
135
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
136 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
137 * init_colors:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
138 * Initialize the potion color scheme for this time
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
139 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
140
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
141 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
142 init_colors(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
143 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
144 register int i, j;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
145
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
146 for (i = 0; i < NCOLORS; i++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
147 used[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
148
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
149 for (i = 0 ; i < MAXPOTIONS ; i++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
150 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
151 do
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
152 j = rnd(NCOLORS);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
153 until (!used[j]);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
154 used[j] = TRUE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
155 p_colors[i] = rainbow[j];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
156 p_know[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
157 p_guess[i] = NULL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
158 if (i > 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
159 p_magic[i].mi_prob += p_magic[i-1].mi_prob;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
160 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
161 badcheck("potions", p_magic, MAXPOTIONS);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
162 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
163
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
164 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
165 * do any initialization for food
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
166 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
167
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
168 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
169 init_foods(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
170 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
171 register int i;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
172
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
173 for (i=0; i < MAXFOODS; i++) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
174 if (i > 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
175 foods[i].mi_prob += foods[i-1].mi_prob;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
176 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
177 badcheck("foods", foods, MAXFOODS);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
178 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
179
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
180 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
181 * init_materials:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
182 * Initialize the construction materials for wands and staffs
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
183 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
184
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
185 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
186 init_materials(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
187 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
188 register int i, j;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
189 register char *str;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
190 static bool metused[NMETAL];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
191
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
192 for (i = 0; i < NWOOD; i++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
193 used[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
194 for (i = 0; i < NMETAL; i++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
195 metused[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
196
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
197 for (i = 0 ; i < MAXSTICKS ; i++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
198 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
199 for (;;)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
200 if (rnd(100) > 50)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
201 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
202 j = rnd(NMETAL);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
203 if (!metused[j])
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
204 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
205 ws_type[i] = "wand";
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
206 str = metal[j];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
207 metused[j] = TRUE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
208 break;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
209 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
210 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
211 else
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
212 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
213 j = rnd(NWOOD);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
214 if (!used[j])
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
215 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
216 ws_type[i] = "staff";
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
217 str = wood[j];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
218 used[j] = TRUE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
219 break;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
220 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
221 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
222
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
223 ws_made[i] = str;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
224 ws_know[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
225 ws_guess[i] = NULL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
226 if (i > 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
227 ws_magic[i].mi_prob += ws_magic[i-1].mi_prob;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
228 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
229 badcheck("sticks", ws_magic, MAXSTICKS);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
230 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
231
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
232 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
233 * do any initialization for miscellaneous magic
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
234 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
235
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
236 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
237 init_misc(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
238 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
239 register int i;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
240
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
241 for (i=0; i < MAXMM; i++) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
242 m_know[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
243 m_guess[i] = NULL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
244 if (i > 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
245 m_magic[i].mi_prob += m_magic[i-1].mi_prob;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
246 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
247 badcheck("miscellaneous magic", m_magic, MAXMM);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
248 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
249
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
250 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
251 * init_names:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
252 * Generate the names of the various scrolls
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
253 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
254
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
255 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
256 init_names(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
257 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
258 register int nsyl;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
259 register char *cp, *sp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
260 register int i, nwords;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
261
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
262 for (i = 0 ; i < MAXSCROLLS ; i++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
263 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
264 cp = prbuf;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
265 nwords = rnd(cols/20) + 1 + (cols > 40 ? 1 : 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
266 while(nwords--)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
267 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
268 nsyl = rnd(3)+1;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
269 while(nsyl--)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
270 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
271 sp = sylls[rnd((sizeof sylls) / (sizeof (char *)))];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
272 while(*sp)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
273 *cp++ = *sp++;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
274 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
275 *cp++ = ' ';
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
276 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
277 *--cp = '\0';
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
278 s_names[i] = (char *) new(strlen(prbuf)+1);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
279 s_know[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
280 s_guess[i] = NULL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
281 strcpy(s_names[i], prbuf);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
282 if (i > 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
283 s_magic[i].mi_prob += s_magic[i-1].mi_prob;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
284 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
285 badcheck("scrolls", s_magic, MAXSCROLLS);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
286 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
287
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
288 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
289 * init_player:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
290 * roll up the rogue
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
291 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
292
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
293 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
294 init_player(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
295 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
296 int stat_total, round, minimum, maximum, ch, i, j;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
297 short do_escape, *our_stats[NUMABILITIES-1];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
298 struct linked_list *weap_item, *armor_item;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
299 struct object *obj;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
300
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
301 weap_item = armor_item = NULL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
302
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
303 if (char_type == -1) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
304 /* See what type character will be */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
305 wclear(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
306 touchwin(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
307 wmove(hw,2,0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
308 for(i=1; i<=NUM_CHARTYPES-1; i++) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
309 wprintw(hw,"[%d] %s\n",i,char_class[i-1].name);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
310 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
311 mvwaddstr(hw, 0, 0, "What character class do you desire? ");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
312 draw(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
313 char_type = (wgetch(hw) - '0');
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
314 while (char_type < 1 || char_type > NUM_CHARTYPES-1) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
315 wmove(hw,0,0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
316 wprintw(hw,"Please enter a character type between 1 and %d: ",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
317 NUM_CHARTYPES-1);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
318 draw(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
319 char_type = (wgetch(hw) - '0');
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
320 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
321 char_type--;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
322 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
323 player.t_ctype = char_type;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
324 player.t_quiet = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
325 pack = NULL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
326
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
327 /* Select the gold */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
328 purse = 2700;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
329 switch (player.t_ctype) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
330 case C_FIGHTER:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
331 purse += 1800;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
332 when C_THIEF:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
333 case C_ASSASIN:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
334 purse += 600;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
335 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
336 #ifdef WIZARD
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
337 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
338 * allow me to describe a super character
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
339 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
340 if (wizard && strcmp(getenv("SUPER"),"YES") == 0) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
341 pstats.s_str = 25;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
342 pstats.s_intel = 25;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
343 pstats.s_wisdom = 25;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
344 pstats.s_dext = 25;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
345 pstats.s_const = 25;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
346 pstats.s_charisma = 25;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
347 pstats.s_exp = 10000000L;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
348 pstats.s_lvladj = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
349 pstats.s_lvl = 1;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
350 pstats.s_hpt = 500;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
351 pstats.s_carry = totalenc(&player);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
352 strncpy(pstats.s_dmg, "3d4", sizeof(pstats.s_dmg));
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
353 check_level();
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
354 mpos = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
355 if (player.t_ctype == C_FIGHTER ||
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
356 player.t_ctype == C_RANGER ||
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
357 player.t_ctype == C_PALADIN)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
358 weap_item = spec_item(WEAPON, TWOSWORD, 5, 5);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
359 else
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
360 weap_item = spec_item(WEAPON, SWORD, 5, 5);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
361 obj = OBJPTR(weap_item);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
362 obj->o_flags |= ISKNOW;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
363 add_pack(weap_item, TRUE, NULL);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
364 cur_weapon = obj;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
365 if (player.t_ctype != C_MONK) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
366 j = PLATE_ARMOR;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
367 if (player.t_ctype == C_THIEF || player.t_ctype == C_ASSASIN)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
368 j = STUDDED_LEATHER;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
369 armor_item = spec_item(ARMOR, j, 10, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
370 obj = OBJPTR(armor_item);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
371 obj->o_flags |= (ISKNOW | ISPROT);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
372 obj->o_weight = armors[j].a_wght;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
373 add_pack(armor_item, TRUE, NULL);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
374 cur_armor = obj;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
375 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
376 purse += 10000;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
377 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
378 else
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
379 #endif
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
380
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
381 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
382 switch(player.t_ctype) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
383 case C_MAGICIAN:round = A_INTELLIGENCE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
384 when C_FIGHTER: round = A_STRENGTH;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
385 when C_RANGER: round = A_STRENGTH;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
386 when C_PALADIN: round = A_STRENGTH;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
387 when C_CLERIC: round = A_WISDOM;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
388 when C_DRUID: round = A_WISDOM;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
389 when C_THIEF: round = A_DEXTERITY;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
390 when C_ASSASIN: round = A_DEXTERITY;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
391 when C_MONK: round = A_DEXTERITY;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
392 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
393
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
394 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
395 wclear(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
396
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
397 /* If there is any news, display it */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
398 if (rogue_news) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
399 register int i;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
400
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
401 /* Print a separator line */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
402 wmove(hw, 12, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
403 for (i=0; i<cols; i++) waddch(hw, '-');
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
404
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
405 /* Print the news */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
406 mvwaddstr(hw, 14, 0, rogue_news);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
407 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
408
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
409 stat_total = MAXSTATS;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
410 do_escape = FALSE; /* No escape seen yet */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
411
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
412 /* Initialize abilities */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
413 pstats.s_intel = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
414 pstats.s_str = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
415 pstats.s_wisdom = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
416 pstats.s_dext = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
417 pstats.s_const = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
418 pstats.s_charisma = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
419
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
420 /* Initialize pointer into abilities */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
421 our_stats[A_INTELLIGENCE] = &pstats.s_intel;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
422 our_stats[A_STRENGTH] = &pstats.s_str;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
423 our_stats[A_WISDOM] = &pstats.s_wisdom;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
424 our_stats[A_DEXTERITY] = &pstats.s_dext;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
425 our_stats[A_CONSTITUTION] = &pstats.s_const;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
426
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
427 /* Let player distribute attributes */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
428 for (i=0; i<NUMABILITIES-1; i++) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
429 wmove(hw, 2, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
430 wprintw(hw, "You are creating a %s with %2d attribute points.",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
431 char_class[player.t_ctype].name, stat_total);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
432
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
433 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
434 * Player must have a minimum of 7 in any attribute and 11 in
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
435 * the player's primary attribute.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
436 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
437 minimum = (round == i ? 11 : 7);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
438
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
439 /* Subtract out remaining minimums */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
440 maximum = stat_total - (7 * (NUMABILITIES-1 - i));
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
441
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
442 /* Subtract out remainder of profession minimum (11 - 7) */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
443 if (round > i) maximum -= 4;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
444
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
445 /* Maximum can't be greater than 18 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
446 if (maximum > 18) maximum = 18;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
447
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
448 wmove(hw, 4, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
449 wprintw(hw,
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
450 "Minimum: %2d; Maximum: %2d (%s corrects previous entry)",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
451 minimum, maximum, unctrl('\b'));
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
452
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
453 wmove(hw, 6, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
454 wprintw(hw, " Int: %-2d", pstats.s_intel);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
455 wprintw(hw, " Str: %-2d", pstats.s_str);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
456 wprintw(hw, " Wis: %-2d", pstats.s_wisdom);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
457 wprintw(hw, " Dex: %-2d", pstats.s_dext);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
458 wprintw(hw, " Con: %-2d", pstats.s_const);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
459 wprintw(hw, " Cha: %-2d", pstats.s_charisma);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
460 wclrtoeol(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
461 wmove(hw, 6, 11*i + 9);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
462 if (do_escape == FALSE) draw(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
463
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
464 /* Get player's input */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
465 if (do_escape || maximum == minimum) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
466 *our_stats[i] = maximum;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
467 stat_total -= maximum;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
468 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
469 else for (;;) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
470 ch = wgetch(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
471 if (ch == '\b') { /* Backspace */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
472 if (i == 0) continue; /* Can't move back */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
473 else {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
474 stat_total += *our_stats[i-1];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
475 *our_stats[i] = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
476 *our_stats[i-1] = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
477 i -= 2; /* Back out */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
478 break;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
479 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
480 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
481 if (ch == '\033') { /* Escape */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
482 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
483 * Escape will result in using all maximums for
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
484 * remaining abilities.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
485 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
486 do_escape = TRUE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
487 *our_stats[i] = maximum;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
488 stat_total -= maximum;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
489 break;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
490 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
491
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
492 /* Do we have a legal digit? */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
493 if (ch >= '0' && ch <= '9') {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
494 ch -= '0'; /* Convert it to a number */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
495 *our_stats[i] = 10 * *our_stats[i] + ch;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
496
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
497 /* Is the number in range? */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
498 if (*our_stats[i] >= minimum &&
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
499 *our_stats[i] <= maximum) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
500 stat_total -= *our_stats[i];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
501 break;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
502 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
503
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
504 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
505 * If it's too small, get more - 1x is the only
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
506 * allowable case.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
507 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
508 if (*our_stats[i] < minimum && *our_stats[i] == 1) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
509 /* Print the player's one */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
510 waddch(hw, '1');
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
511 draw(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
512 continue;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
513 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
514 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
515
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
516 /* Error condition */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
517 putchar('\007');
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
518 *our_stats[i] = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
519 i--; /* Rewind */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
520 break;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
521 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
522 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
523
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
524 /* Discard extra points over 18 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
525 if (stat_total > 18) stat_total = 18;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
526
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
527 /* Charisma gets what's left */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
528 pstats.s_charisma = stat_total;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
529
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
530 /* Intialize constants */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
531 pstats.s_lvl = 1;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
532 pstats.s_lvladj = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
533 pstats.s_exp = 0L;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
534 strncpy(pstats.s_dmg, "1d4", sizeof(pstats.s_dmg));
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
535 pstats.s_carry = totalenc(&player);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
536
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
537 /* Get the hit points. */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
538 pstats.s_hpt = 12 + const_bonus(); /* Base plus bonus */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
539
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
540 /* Add in the component that varies according to class */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
541 pstats.s_hpt += char_class[player.t_ctype].hit_pts;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
542
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
543 /* Display the character */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
544 wmove(hw, 2, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
545 wprintw(hw,"You are creating a %s.",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
546 char_class[player.t_ctype].name);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
547 wclrtoeol(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
548
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
549 /* Get rid of max/min line */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
550 wmove(hw, 4, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
551 wclrtoeol(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
552
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
553 wmove(hw, 6, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
554 wprintw(hw, " Int: %2d", pstats.s_intel);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
555 wprintw(hw, " Str: %2d", pstats.s_str);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
556 wprintw(hw, " Wis: %2d", pstats.s_wisdom);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
557 wprintw(hw, " Dex: %2d", pstats.s_dext);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
558 wprintw(hw, " Con: %2d", pstats.s_const);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
559 wprintw(hw, " Cha: %2d", pstats.s_charisma);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
560 wclrtoeol(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
561
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
562 wmove(hw, 8, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
563 wprintw(hw, " Hp: %2d", pstats.s_hpt);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
564 wclrtoeol(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
565
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
566 wmove(hw, 10, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
567 wprintw(hw, " Gold: %d", purse);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
568
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
569 mvwaddstr(hw, 0, 0, "Is this character okay? ");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
570 draw(hw);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
571 } while(wgetch(hw) != 'y');
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
572 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
573
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
574 pstats.s_arm = 10;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
575 max_stats = pstats;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
576
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
577 /* Set up the initial movement rate */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
578 player.t_action = A_NIL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
579 player.t_movement = 6;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
580 player.t_no_move = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
581 player.t_using = NULL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
582 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
583
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
584
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
585
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
586
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
587
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
588
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
589 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
590 * init_stones:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
591 * Initialize the ring stone setting scheme for this time
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
592 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
593
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
594 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
595 init_stones(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
596 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
597 register int i, j;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
598
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
599 for (i = 0; i < NSTONES; i++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
600 used[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
601
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
602 for (i = 0 ; i < MAXRINGS ; i++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
603 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
604 do
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
605 j = rnd(NSTONES);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
606 until (!used[j]);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
607 used[j] = TRUE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
608 r_stones[i] = stones[j];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
609 r_know[i] = FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
610 r_guess[i] = NULL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
611 if (i > 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
612 r_magic[i].mi_prob += r_magic[i-1].mi_prob;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
613 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
614 badcheck("rings", r_magic, MAXRINGS);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
615 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
616
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
617 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
618 * init_things
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
619 * Initialize the probabilities for types of things
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
620 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
621 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 126
diff changeset
622 init_things(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
623 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
624 register struct magic_item *mp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
625
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
626 for (mp = &things[1] ; mp < &things[NUMTHINGS] ; mp++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
627 mp->mi_prob += (mp-1)->mi_prob;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
628 badcheck("things", things, NUMTHINGS);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
629 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
630
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
631