[9] | 1 | /*
|
---|
| 2 | Initialization of adventure play variables
|
---|
| 3 | */
|
---|
| 4 | #include <string.h>
|
---|
| 5 | #include <stdio.h>
|
---|
| 6 | #include "advent.h" /* #define preprocessor equates */
|
---|
| 7 | #define EXTERN /* define, not declare, in advdec.h */
|
---|
| 8 | #include "advdec.h"
|
---|
| 9 |
|
---|
| 10 | int plac[MAXOBJ] = {
|
---|
| 11 | 0, 0, 3, 8, 10, 11, 0, 14, 0, 148, /* 0 - 9 */
|
---|
| 12 | 96, 19, 17, 101, 103, 0, 106, 0, 0, 238, /* 10 - 19 */
|
---|
| 13 | 238, 117, 190, 109, 25, 23, 111, 35, 0, 97, /* 20 - 29 */
|
---|
| 14 | 0, 119, 0, 117, 0, 130, 0, 126, 140, 0, /* 30 - 39 */
|
---|
| 15 | 96, 94, 158, 160, 188, 0, 155, 174, 166, 228, /* 40 - 49 */
|
---|
| 16 | 18, 204, 27, 29, 30, 0, 92, 168, 97, 100, /* 50 - 59 */
|
---|
| 17 | 101, 0, 119, 127, 130, 141, 144, 205, 28, 182, /* 60 - 69 */
|
---|
| 18 | 225, 230, 0, 147, 241, 248, 0, 0, 0, 0, /* 70 - 79 */
|
---|
| 19 | 0, 0, 0, 0, 0, 0, 0, 193, 102, 0, /* 80 - 89 */
|
---|
| 20 | 159, 141, 172, 188, 189, 0, 0, 193, 227, 174, /* 90 - 99 */
|
---|
| 21 | 0, 13, 238, 217, 171, 0, 146, 159, 3, 0, /* 100 - 109 */
|
---|
| 22 | 0, 0, 0, 3, 180, 39, 5, 0, 110, 169, /* 110 - 119 */
|
---|
| 23 | 200
|
---|
| 24 | };
|
---|
| 25 |
|
---|
| 26 | int fixd[MAXOBJ] = {
|
---|
| 27 | 0, 0, 0, 9, 0, 0, 0, 15, 0, 0, /* 0 - 9 */
|
---|
| 28 | 0, -1, 27, -1, 0, 0, 0, -1, 0, 0, /* 10 - 19 */
|
---|
| 29 | 0, 122, 235, -1, -1, 67, -1, 110, 0, -1, /* 20 - 29 */
|
---|
| 30 | -1, 121, 0, 122, 0, -1, -1, -1, -1, 0, /* 30 - 39 */
|
---|
| 31 | -1, -1, 166, 167, 189, 0, 0, -1, 0, 229, /* 40 - 49 */
|
---|
| 32 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50 - 59 */
|
---|
| 33 | 0, 0, 121, 0, -1, 0, 0, 0, 0, 0, /* 60 - 69 */
|
---|
| 34 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */
|
---|
| 35 | 0, 0, 0, 0, 0, 0, 0, -1, 194, -1, /* 80 - 89 */
|
---|
| 36 | 0, -1, 174, -1, -1, 0, 0, -1, -1, -1, /* 90 - 99 */
|
---|
| 37 | 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, /* 100 - 109 */
|
---|
| 38 | 0, 0, -1, 0, 0, -1, -1, 0, 0, 0, /* 110 - 119 */
|
---|
| 39 | 0
|
---|
| 40 | };
|
---|
| 41 |
|
---|
| 42 | struct playinfo g = {
|
---|
| 43 | 0, /* turns */
|
---|
| 44 | 1, /* loc */
|
---|
| 45 | 1, /* oldloc */
|
---|
| 46 | 1, /* oldloc2 */
|
---|
| 47 | 1, /* newloc */
|
---|
| 48 | { /* loc_attrib[MAXLOC] */
|
---|
| 49 | 0, 73, 65, 73, 73, /* 0 - 4 */
|
---|
| 50 | 65, 65, 73, 1601, 33, /* 5 - 9 */
|
---|
| 51 | 32, 32, 32, 1824, 32, /* 10 - 14 */
|
---|
| 52 | 0, 2, 0, 0, 2816, /* 15 - 19 */
|
---|
| 53 | 2, 2, 2, 0, 10, /* 20 - 24 */
|
---|
| 54 | 0, 2, 0, 0, 0, /* 25 - 29 */
|
---|
| 55 | 0, 2, 2, 8, 0, /* 30 - 34 */
|
---|
| 56 | 0, 0, 0, 8, 0, /* 35 - 39 */
|
---|
| 57 | 2, 0, 256, 256, 256, /* 40 - 44 */
|
---|
| 58 | 256, 272, 272, 272, 256, /* 45 - 49 */
|
---|
| 59 | 256, 0, 256, 256, 272, /* 50 - 54 */
|
---|
| 60 | 256, 272, 0, 16, 2, /* 55 - 59 */
|
---|
| 61 | 0, 0, 0, 0, 0, /* 60 - 64 */
|
---|
| 62 | 0, 0, 0, 0, 0, /* 65 - 69 */
|
---|
| 63 | 0, 0, 0, 0, 0, /* 70 - 74 */
|
---|
| 64 | 0, 0, 0, 0, 2, /* 75 - 79 */
|
---|
| 65 | 256, 256, 272, 0, 0, /* 80 - 84 */
|
---|
| 66 | 16, 272, 0, 0, 2, /* 85 - 89 */
|
---|
| 67 | 2, 0, 0, 0, 0, /* 90 - 94 */
|
---|
| 68 | 8, 0, 0, 1280, 513, /* 95 - 99 */
|
---|
| 69 | 513, 512, 0, 0, 0, /* 00 - 04 */
|
---|
| 70 | 0, 0, 0, 768, 0, /* 105 - 109 */
|
---|
| 71 | 0, 0, 0, 8, 0, /* 110 - 114 */
|
---|
| 72 | 1, 1, 0, 0, 0, /* 115 - 119 */
|
---|
| 73 | 0, 0, 16, 16, 16, /* 120 - 124 */
|
---|
| 74 | 16, 17, 16, 16, 16, /* 125 - 129 */
|
---|
| 75 | 16, 0, 0, 0, 0, /* 130 - 134 */
|
---|
| 76 | 0, 0, 0, 0, 0, /* 135 - 139 */
|
---|
| 77 | 0, 1040, 16, 0, 0, /* 140 - 144 */
|
---|
| 78 | 2, 65, 65, 65, 65, /* 145 - 149 */
|
---|
| 79 | 65, 65, 65, 65, 65, /* 150 - 154 */
|
---|
| 80 | 65, 3, 2625, 2113, 65, /* 155 - 159 */
|
---|
| 81 | 65, 3, 3, 3, 3, /* 160 - 164 */
|
---|
| 82 | 3, 41, 41, 9, 9, /* 165 - 169 */
|
---|
| 83 | 0, 0, 0, 0, 0, /* 170 - 174 */
|
---|
| 84 | 0, 0, 0, 2, 0, /* 175 - 179 */
|
---|
| 85 | 0, 2, 0, 0, 0, /* 180 - 184 */
|
---|
| 86 | 0, 0, 0, 0, 16, /* 185 - 189 */
|
---|
| 87 | 0, 0, 9, 0, 0, /* 190 - 194 */
|
---|
| 88 | 0, 0, 0, 9, 2, /* 195 - 199 */
|
---|
| 89 | 1, 1, 2304, 0, 0, /* 200 - 204 */
|
---|
| 90 | 0, 8, 8, 8, 0, /* 205 - 209 */
|
---|
| 91 | 0, 0, 1, 0, 9, /* 210 - 214 */
|
---|
| 92 | 0, 0, 12, 0, 0, /* 215 - 219 */
|
---|
| 93 | 0, 0, 0, 0, 0, /* 220 - 224 */
|
---|
| 94 | 0, 2, 2625, 73, 73, /* 225 - 229 */
|
---|
| 95 | 0, 2, 2, 2, 2, /* 230 - 234 */
|
---|
| 96 | 0, 0, 2, 65, 3137, /* 235 - 239 */
|
---|
| 97 | 65, 65, 65, 65, 65, /* 240 - 244 */
|
---|
| 98 | 65, 65, 65, 65 /* 245 - 249 */
|
---|
| 99 | }, /* loc_attrib[MAXLOC] */
|
---|
| 100 | {0 }, /* place[MAXOBJ] */
|
---|
| 101 | {0 }, /* fixed[MAXOBJ] */
|
---|
| 102 | { /* weight[MAXOBJ] */
|
---|
| 103 | 0, 0, 1, 0, 1, 2, 2, 0, 0, 2, /* 0 - 9 */
|
---|
| 104 | 1, 0, 0, 0, 7, 7, 1, 0, 0, 2, /* 10 - 19 */
|
---|
| 105 | 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* 20 - 29 */
|
---|
| 106 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, /* 30 - 39 */
|
---|
| 107 | 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, /* 40 - 49 */
|
---|
| 108 | 6, 1, 2, 2, 3, 5, 4, 3, 2, 3, /* 50 - 59 */
|
---|
| 109 | 4, 1, 3, 1, 3, 2, 1, 1, 2, 2, /* 60 - 69 */
|
---|
| 110 | 2, 3, 1, 1, 3, 1, 0, 0, 0, 0, /* 70 - 79 */
|
---|
| 111 | 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, /* 70 - 79 */
|
---|
| 112 | 1, 0, 0, 0, 0, 3, 2, 0, 0, 0, /* 80 - 89 */
|
---|
| 113 | 0, 2, 1, 0, 0, 0, 1, 1, 2, 0, /* 100 - 109 */
|
---|
| 114 | 3, 3, 0, 1, 1, 0, 0, 0, 3, 1, /* 110 - 119 */
|
---|
| 115 | 2, 0, 0 /* 120 - 129 */
|
---|
| 116 | }, /* weight[MAXOBJ] */
|
---|
| 117 | {0 }, /* atloc[MAXLOC] */
|
---|
| 118 | {0 }, /* link[MAXOBJ * 2] */
|
---|
| 119 | {0 }, /* holder[MAXOBJ] */
|
---|
| 120 | {0 }, /* hlink[MAXOBJ] */
|
---|
| 121 | {0 }, /* visited[MAXLOC] */
|
---|
| 122 | {0 }, /* prop[MAXOBJ] */
|
---|
| 123 | { /* obj_state[MAXOBJ] */
|
---|
| 124 | 0, 0, 32800, 26, 32770, /* 0 - 4 */
|
---|
| 125 | 32, 32, 8192, 0, 0, /* 5 - 9 */
|
---|
| 126 | 32, 512, 0, 256, 770, /* 10 - 14 */
|
---|
| 127 | 770, 288, 512, 0, 160, /* 15 - 19 */
|
---|
| 128 | 32802, 0, 0, 0, 128, /* 20 - 24 */
|
---|
| 129 | 0, 0, 0, 32, 8192, /* 25 - 29 */
|
---|
| 130 | 512, 512, 0, 512, 0, /* 30 - 34 */
|
---|
| 131 | 512, 256, 0, 32768, 8224, /* 35 - 39 */
|
---|
| 132 | 0, 18, 26, 26, 2, /* 40 - 44 */
|
---|
| 133 | 0, 8320, 18464, 32768, 0, /* 45 - 49 */
|
---|
| 134 | 16384, 16416, 16416, 26656, 24608, /* 50 - 54 */
|
---|
| 135 | 49240, 24608, 16384, 49184, 16416, /* 55 - 59 */
|
---|
| 136 | 16416, 16416, 16384, 16544, 16442, /* 60 - 64 */
|
---|
| 137 | 16416, 18464, 26656, 16416, 16416, /* 65 - 69 */
|
---|
| 138 | 49184, 49154, 18464, 18464, 16416, /* 70 - 74 */
|
---|
| 139 | 16416, 0, 0, 0, 0, /* 75 - 79 */
|
---|
| 140 | 0, 0, 0, 0, 0, /* 80 - 84 */
|
---|
| 141 | 0, 0, 8704, 0, 0, /* 85 - 89 */
|
---|
| 142 | 0, 0, 0, 0, 32768, /* 90 - 94 */
|
---|
| 143 | 0, 128, 0, 0, 0, /* 95 - 99 */
|
---|
| 144 | 0, 160, 8224, 0, 0, /* 100 - 104 */
|
---|
| 145 | 0, 8352, 8352, 32870, 0, /* 105 - 109 */
|
---|
| 146 | 16674, 258, 32858, 288, 32, /* 110 - 114 */
|
---|
| 147 | 256, 0, 0, 32866, 16416, /* 115 - 119 */
|
---|
| 148 | 16416, 0, 0 /* 120 - 123 */
|
---|
| 149 | }, /* obj_state[MAXOBJ] */
|
---|
| 150 | { /* points[MAXOBJ] */
|
---|
| 151 | 0, 0, 0, 0, 0, /* 0 - 4 */
|
---|
| 152 | 0, 0, 0, 0, 0, /* 5 - 9 */
|
---|
| 153 | 0, 0, 0, 0, 0, /* 10 - 14 */
|
---|
| 154 | 0, 1000108, 0, 0, 0, /* 15 - 19 */
|
---|
| 155 | 0, 0, 0, 0, 0, /* 20 - 24 */
|
---|
| 156 | 0, 0, 0, 0, 0, /* 25 - 29 */
|
---|
| 157 | 0, 0, 0, 0, 0, /* 30 - 34 */
|
---|
| 158 | 0, 0, 0, 0, 0, /* 35 - 39 */
|
---|
| 159 | 0, 0, 0, 0, 0, /* 40 - 44 */
|
---|
| 160 | 0, 0, -3000112, 0, 0, /* 45 - 49 */
|
---|
| 161 | -2000055, -2000112, -2000112, -1000112, -5000112, /* 50 - 54 */
|
---|
| 162 | 5000003, -3000112, -2000055, 2000003, -3000112, /* 55 - 59 */
|
---|
| 163 | -4000112, -4000112, 3000003, -1000112, -4000112, /* 60 - 64 */
|
---|
| 164 | -4000112, -2000112, -3000112, -1000112, -1000112, /* 65 - 69 */
|
---|
| 165 | -2000112, -3012055, -4000112, -1000112, -5000112, /* 70 - 74 */
|
---|
| 166 | -5000112, 0, 0, 0, 0, /* 75 - 79 */
|
---|
| 167 | 0, 0, 0, 0, 0, /* 80 - 84 */
|
---|
| 168 | 0, 0, 0, 0, 0, /* 85 - 89 */
|
---|
| 169 | 0, 0, 0, 0, 0, /* 90 - 94 */
|
---|
| 170 | 0, 0, 0, 0, 0, /* 95 - 99 */
|
---|
| 171 | 0, 0, 0, 0, 0, /* 100 - 104 */
|
---|
| 172 | 0, 0, 0, 0, 0, /* 105 - 109 */
|
---|
| 173 | -2000112, 0, 0, 0, 0, /* 110 - 114 */
|
---|
| 174 | 0, 0, 0, 0, -4000118, /* 115 - 119 */
|
---|
| 175 | -2000112, 0 /* 120 - 122 */
|
---|
| 176 | }, /* points[MAXOBJ] */
|
---|
| 177 | {0 }, /* hinted[HNTMAX+1] */
|
---|
| 178 | { /* hints[HNTMAX+1][5] */
|
---|
| 179 | { 0, 0, 0, 0, 0 }, /* 0 */
|
---|
| 180 | { 0, 9999, 4, 0, 0 }, /* 1 */
|
---|
| 181 | { 0, 9999, 10, 0, 0 }, /* 2 */
|
---|
| 182 | { 0, 9999, 5, 0, 0 }, /* 3 */
|
---|
| 183 | { 0, 0, 0, 0, 0 }, /* 4 */
|
---|
| 184 | { 0, 0, 0, 0, 0 }, /* 5 */
|
---|
| 185 | { 0, 0, 0, 0, 0 }, /* 6 */
|
---|
| 186 | { 0, 15, 4, 176, 177 }, /* 7 */
|
---|
| 187 | { 0, 8, 5, 178, 179 }, /* 8 */
|
---|
| 188 | { 0, 13, 3, 180, 181 }, /* 9 */
|
---|
| 189 | { 0, 6, 10, 211, 212 }, /* 10 */
|
---|
| 190 | { 0, 6, 5, 213, 214 }, /* 11 */
|
---|
| 191 | { 0, 4, 2, 62, 63 }, /* 12 */
|
---|
| 192 | { 0, 5, 2, 18, 19 }, /* 13 */
|
---|
| 193 | { 0, 4, 2, 62, 233 }, /* 14 */
|
---|
| 194 | { 0, 6, 5, 274, 275 }, /* 15 */
|
---|
| 195 | { 0, 10, 5, 289, 290 }, /* 16 */
|
---|
| 196 | { 0, 8, 2, 20, 21 }, /* 17 */
|
---|
| 197 | { 0, 5, 2, 404, 405 } /* 18 */
|
---|
| 198 | }, /* hints[HNTMAX+1][5] */
|
---|
| 199 | {0 }, /* hintlc[HNTMAX+1] */
|
---|
| 200 | 0, /* tally */
|
---|
| 201 | 0, /* tally2 */
|
---|
| 202 | 0, /* limit */
|
---|
| 203 | 0, /* lmwarn */
|
---|
| 204 | 0, /* wzdark */
|
---|
| 205 | 0, /* closing */
|
---|
| 206 | 0, /* closed */
|
---|
| 207 | 0, /* holding */
|
---|
| 208 | 0, /* detail */
|
---|
| 209 | 0, /* knfloc */
|
---|
| 210 | 30, /* clock */
|
---|
| 211 | 50, /* clock2 */
|
---|
| 212 | 0, /* panic */
|
---|
| 213 | { 0, 19, 27, 33, 44, 64, 114 }, /* dloc[DWARFMAX+1] */
|
---|
| 214 | 0, /* dflag */
|
---|
| 215 | { 0, 0, 0, 0, 0, 0, 0 }, /* dseen[DWARFMAX+1] */
|
---|
| 216 | { 0, 0, 0, 0, 0, 0, 0 }, /* odloc[DWARFMAX+1] */
|
---|
| 217 | 18, /* daltloc */
|
---|
| 218 | 0, /* dkill */
|
---|
| 219 | 114, /* chloc */
|
---|
| 220 | 140, /* chloc2 */
|
---|
| 221 | 0, /* bonus */
|
---|
| 222 | 0, /* numdie */
|
---|
| 223 | 0, /* foobar */
|
---|
| 224 | 0, /* combo */
|
---|
| 225 | 0, /* terse */
|
---|
| 226 | 5, /* abbnum */
|
---|
| 227 | 100, /* health */
|
---|
| 228 | 0, /* chase */
|
---|
| 229 | FALSE, /* flg239 */
|
---|
| 230 | 0 /* lastglob */
|
---|
| 231 | };
|
---|
| 232 |
|
---|
| 233 | /*
|
---|
| 234 | Initialization of adventure play variables
|
---|
| 235 | */
|
---|
| 236 | void initialize()
|
---|
| 237 | {
|
---|
| 238 | int i;
|
---|
| 239 |
|
---|
| 240 | for (i = MAXOBJ; i > 0; i--) {
|
---|
| 241 | g.fixed[i] = fixd[i];
|
---|
| 242 | if (fixd[i] > 0) {
|
---|
| 243 | drop(i + MAXOBJ, fixd[i]);
|
---|
| 244 | drop(i, plac[i]);
|
---|
| 245 | }
|
---|
| 246 | if ((plac[i] != 0) && (fixd[i] <= 0))
|
---|
| 247 | drop(i, plac[i]);
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | for (i = 1; i <= MAXOBJ; i++) {
|
---|
| 251 | if (treasr(i)) {
|
---|
| 252 | g.prop[i] = -1;
|
---|
| 253 | g.tally++;
|
---|
| 254 | }
|
---|
| 255 | }
|
---|
| 256 |
|
---|
| 257 | newtravel = TRUE;
|
---|
| 258 | g.place[BOOK] = -1;
|
---|
| 259 | insert(BOOK, SAFE);
|
---|
| 260 | g.place[WATER] = -1;
|
---|
| 261 | insert(WATER, BOTTLE);
|
---|
| 262 | g.prop[BOTTLE] = 8;
|
---|
| 263 | return;
|
---|
| 264 | }
|
---|