1 /* 2 * global variable initializaton 3 * 4 * @(#)extern.c 5.2 (Berkeley) 6/16/82 5 */ 6 7 #include "rogue.h" 8 #include "curses.h" 9 10 #ifdef LOG 11 int captains_log = FALSE; 12 #endif LOG 13 #ifdef SDEBUG 14 int is_com; 15 #endif SDEBUG 16 /* 17 * revno: current revision level 18 * verno: current version of a particular rev 19 */ 20 int revno = REV; 21 int verno = VER; 22 23 /* 24 * All this should be low as possible in memory so that 25 * we can save the min 26 */ 27 char *w_names[MAXWEAPONS + 1] = { /* Names of the various weapons */ 28 "mace", 29 "long sword", 30 "short bow", 31 "arrow", 32 "dagger", 33 "two handed sword", 34 "dart", 35 "crossbow", 36 "crossbow bolt", 37 "spear", 38 NULL /* fake entry for dragon's breath */ 39 }; 40 char *a_names[MAXARMORS] = { /* Names of armor types */ 41 "leather armor", 42 "ring mail", 43 "studded leather armor", 44 "scale mail", 45 "chain mail", 46 "splint mail", 47 "banded mail", 48 "plate mail" 49 }; 50 51 int a_chances[MAXARMORS] = { /* Chance for each armor type */ 52 20, 53 35, 54 50, 55 63, 56 75, 57 85, 58 95, 59 100 60 }; 61 int a_class[MAXARMORS] = { /* Armor class for each armor type */ 62 8, 63 7, 64 7, 65 6, 66 5, 67 4, 68 4, 69 3 70 }; 71 72 struct magic_item s_magic[MAXSCROLLS] = { 73 { "monster confusion", 8, 140 }, 74 { "magic mapping", 5, 150 }, 75 { "hold monster", 3, 180 }, 76 { "sleep", 5, 5 }, 77 { "enchant armor", 8, 160 }, 78 { "identify", 27, 100 }, 79 { "scare monster", 4, 200 }, 80 { "food detection", 4, 50 }, 81 { "teleportation", 7, 165 }, 82 { "enchant weapon", 10, 150 }, 83 { "create monster", 5, 75 }, 84 { "remove curse", 8, 105 }, 85 { "aggravate monsters", 4, 20 }, 86 { "blank paper", 1, 5 }, 87 { "vorpalize weapon", 1, 300 } 88 }; 89 90 struct magic_item p_magic[MAXPOTIONS] = { 91 { "confusion", 8, 5 }, 92 { "paralysis", 10, 5 }, 93 { "poison", 8, 5 }, 94 { "gain strength", 15, 150 }, 95 { "see invisible", 2, 100 }, 96 { "healing", 15, 130 }, 97 #ifdef DEMO 98 { "advertisement", 6, 130 }, 99 #else 100 { "monster detection", 6, 130 }, 101 #endif DEMO 102 { "magic detection", 6, 105 }, 103 { "raise level", 2, 250 }, 104 { "extra healing", 5, 200 }, 105 { "haste self", 4, 190 }, 106 { "restore strength", 14, 130 }, 107 { "blindness", 4, 5 }, 108 { "thirst quenching", 1, 5 } 109 }; 110 111 struct magic_item r_magic[MAXRINGS] = { 112 { "protection", 9, 400 }, 113 { "add strength", 9, 400 }, 114 { "sustain strength", 5, 280 }, 115 { "searching", 10, 420 }, 116 { "see invisible", 10, 310 }, 117 { "adornment", 1, 10 }, 118 { "aggravate monster", 10, 10 }, 119 { "dexterity", 8, 440 }, 120 { "increase damage", 8, 400 }, 121 { "regeneration", 4, 460 }, 122 { "slow digestion", 9, 240 }, 123 { "teleportation", 5, 30 }, 124 { "stealth", 7, 470 }, 125 { "maintain armor", 5, 380 } 126 }; 127 128 struct magic_item ws_magic[MAXSTICKS] = { 129 { "light", 12, 250 }, 130 { "striking", 9, 75 }, 131 { "lightning", 3, 330 }, 132 { "fire", 3, 330 }, 133 { "cold", 3, 330 }, 134 { "polymorph", 15, 310 }, 135 { "magic missile", 10, 170 }, 136 { "haste monster", 9, 5 }, 137 { "slow monster", 11, 350 }, 138 { "drain life", 9, 300 }, 139 { "nothing", 1, 5 }, 140 { "teleport away", 5, 340 }, 141 { "teleport to", 5, 50 }, 142 { "cancellation", 5, 280 } 143 }; 144 145 #ifdef HELP 146 #define MAXHELPC 65 147 char *helpcoms[MAXHELPC] = { 148 "F1 list of commands", 149 "F2 list of symbols", 150 "F3 repeat command", 151 "F4 repeat message", 152 "F5 rename something", 153 "F6 recall what's been discovered", 154 "F7 inventory of your possessions", 155 "F8 identify trap type", 156 "F9 The Any Key (definable)", 157 "Alt F9 defines the Any Key", 158 "F10 Supervisor Key (fake dos)", 159 "Space Clear -More- message", 160 "\x11\xd9 the Enter Key", 161 "\x1b left", 162 "\x19 down", 163 "\x18 up", 164 "\x1a right", 165 "Home up & left", 166 "PgUp up & right", 167 "End down & left", 168 "PgDn down & right", 169 "Scroll Fast Play mode", 170 ". rest", 171 "> go down a staircase", 172 "< go up a staircase", 173 "Esc cancel command", 174 "d drop object", 175 "e eat food", 176 "f find something", 177 "q quaff potion", 178 "r read paper", 179 "s search for trap/secret door", 180 "t throw something", 181 "w wield a weapon", 182 "z zap with a wand", 183 "B run down & left", 184 "H run left", 185 "J run down", 186 "K run up", 187 "L run right", 188 "N run down & right", 189 "U run up & right", 190 "Y run up & left", 191 "W wear armor", 192 "T take armor off", 193 "P put on ring", 194 "Q quit", 195 "R remove ring", 196 "S save game", 197 "^ identify trap", 198 "? help", 199 "/ key", 200 "+ throw", 201 "- zap", 202 "Ctrl t terse message format", 203 "Ctrl r repeat message", 204 "Del search for something hidden", 205 "Ins find something", 206 "a repeat command", 207 "c rename something", 208 "i inventory", 209 "v version number", 210 "! Supervisor Key (fake DOS)", 211 "D list what has been discovered", 212 0 213 }; 214 215 #define MAXHELPO 24 216 char *helpobjs[MAXHELPO] = { 217 "\xfa: the floor", 218 "\x1: the hero", 219 "\x5: some food", 220 "\xc: the amulet of yendor", 221 "\xd: a scroll", 222 "\x18: a weapon", 223 "\x8: a piece of armor", 224 "\xf: some gold", 225 "\xe7: a magic staff", 226 "\xad: a potion", 227 "\x9: a magic ring", 228 "\xb2: a passage", 229 /* make sure in 40 or 80 column none of line draw set connects */ 230 /* this is currently in column 1 for 80 */ 231 "\xce: a door", 232 "\xc9: an upper left corner", 233 "\x04: a trap", 234 "\xcd: a horizontal wall", 235 "\xbc: a lower right corner", 236 "\xc8: a lower left corner", 237 "\xba: a vertical wall", 238 "\xbb: an upper right corner", 239 "\xf0: a stair case", 240 "$,+: safe and perilous magic", 241 "A-Z: 26 different monsters", 242 0 243 }; 244 #endif HELP 245 /* 246 * Names of the various experience levels 247 */ 248 249 char *he_man[] = { 250 "", 251 "Guild Novice", 252 "Apprentice", 253 "Journeyman", 254 "Adventurer", 255 "Fighter", 256 "Warrior", 257 "Rogue", 258 "Champion", 259 "Master Rogue", 260 "Warlord", 261 "Hero", 262 "Guild Master", 263 "Dragonlord", 264 "Wizard", 265 "Rogue Geek", 266 "Rogue Addict", 267 "Schmendrick", 268 "Gunfighter", 269 "Time Waster", 270 "Bug Chaser" 271 }; 272 273 /* 274 * Lattice C compiler funnies 275 */ 276 int maxitems = 0; 277 int reinit = FALSE; 278 279 bool after; /* True if we want after daemons */ 280 bool noscore; /* Was a wizard sometime */ 281 bool again; /* The last command is repeated */ 282 bool s_know[MAXSCROLLS]; /* Does he know what a scroll does */ 283 bool p_know[MAXPOTIONS]; /* Does he know what a potion does */ 284 bool r_know[MAXRINGS]; /* Does he know what a ring does */ 285 bool ws_know[MAXSTICKS]; /* Does he know what a stick does */ 286 bool amulet = FALSE; /* He has the amulet */ 287 bool saw_amulet = FALSE; /* He has seen the amulet */ 288 /* bool askme = TRUE; */ /* Ask about unidentified things */ 289 bool door_stop = FALSE; /* Stop running when we pass a door */ 290 bool fastmode = FALSE; /* Run until you see something */ 291 bool faststate = FALSE; /* Toggle for find (see above) */ 292 /* bool fight_flush = TRUE; */ /* True if toilet input */ 293 bool firstmove = FALSE; /* First move after setting door_stop */ 294 /* bool jump = FALSE; */ /* Show running as series of jumps */ 295 /* bool passgo = TRUE; */ /* Follow passages */ 296 bool playing = TRUE; /* True until he quits */ 297 bool running = FALSE; /* True if player is running */ 298 bool save_msg = TRUE; /* Remember last msg */ 299 /* bool slow_invent = FALSE; */ /* Inventory one line at a time */ 300 bool terse = FALSE; 301 bool expert = FALSE; 302 #ifdef ME 303 int is_me; 304 #endif 305 bool was_trapped = FALSE; /* Was a trap sprung */ 306 #ifdef WIZARD 307 bool wizard = FALSE; /* True if allows wizard commands */ 308 #endif 309 int bailout = FALSE; 310 char take; /* Thing the rogue is taking */ 311 char runch; /* Direction player is running */ 312 /* now names are associated with fixed pointers */ 313 struct array s_names[MAXSCROLLS]; /* Names of the scrolls */ 314 char *p_colors[MAXPOTIONS]; /* Colors of the potions */ 315 char *r_stones[MAXRINGS]; /* Stone settings of the rings */ 316 char *ws_made[MAXSTICKS]; /* What sticks are made of */ 317 /* char *release; */ /* Release number of rogue */ 318 char huh[BUFSIZ]; /* The last message printed */ 319 char *s_guess[MAXSCROLLS]; /* Players guess at what scroll is */ 320 char *p_guess[MAXPOTIONS]; /* Players guess at what potion is */ 321 char *r_guess[MAXRINGS]; /* Players guess at what ring is */ 322 char *ws_guess[MAXSTICKS]; /* Players guess at what wand is */ 323 /* storage array for guesses */ 324 struct array _guesses[MAXSCROLLS+MAXPOTIONS+MAXRINGS+MAXSTICKS]; 325 int iguess = 0; 326 char *ws_type[MAXSTICKS]; /* Is it a wand or a staff */ 327 328 int maxrow; /* Last Line used for map */ 329 int max_level; /* Deepest player has gone */ 330 int ntraps; /* Number of traps on this level */ 331 int dnum; /* Dungeon number */ 332 int level = 1; /* What level rogue is on */ 333 int purse = 0; /* How much gold the rogue has */ 334 int mpos = 0; /* Where cursor is on top line */ 335 int no_move = 0; /* Number of turns held in place */ 336 int no_command = 0; /* Number of turns asleep */ 337 int inpack = 0; /* Number of things in pack */ 338 int total = 0; /* Total dynamic memory bytes */ 339 int no_food = 0; /* Number of levels without food */ 340 int count = 0; /* Number of times to repeat command */ 341 int fung_hit = 0; /* Number of time fungi has hit */ 342 int quiet = 0; /* Number of quiet turns */ 343 int food_left; /* Amount of food in hero's stomach */ 344 int group = 2; /* Current group number */ 345 int hungry_state = 0; /* How hungry is he */ 346 int cksum = CSUM; 347 long seed; /* Random number seed */ 348 349 int hit_mul = P_DAMAGE; 350 int goodchk = 1; 351 char *your_na = "Software Pirate"; 352 char *kild_by = "Copy Protection Mafia"; 353 char *_whoami; 354 355 /* WINDOW *hw; Used as a scratch window */ 356 357 coord oldpos; /* Position before last look() call */ 358 coord delta; /* Change indicated to get_dir() */ 359 360 THING *cur_armor; /* What a well dresssed rogue wears */ 361 THING *cur_ring[2]; /* Which rings are being worn */ 362 THING *cur_weapon; /* Which weapon he is weilding */ 363 364 struct room *oldrp; /* Roomin(&oldpos) */ 365 struct room rooms[MAXROOMS]; /* One for each room -- A level */ 366 struct room passages[MAXPASS] = /* One for each passage */ 367 { 368 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 369 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 370 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 371 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 372 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 373 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 374 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 375 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 376 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 377 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 378 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 }, 379 { {0, 0}, {0, 0}, {0, 0}, 0, ISGONE|ISDARK, 0, 0 } 380 }; 381 382 #define INIT_STATS { 16, 0, 1, 10, 12, "1d4", 12 } 383 384 struct stats max_stats = INIT_STATS; /* The maximum for the player */ 385 386 THING player; /* The rogue */ 387 THING *lvl_obj = NULL; /* List of objects on this level */ 388 THING *mlist = NULL; /* List of monsters on the level */ 389 390 #define ___ 1 391 #define XX 10 392 struct monster monsters[26] = 393 { 394 /* Name CARRY FLAG str, exp, lvl, amr, hpt, dmg */ 395 { "aquator", 0, ISMEAN, { XX, 20, 5, 2, ___, "0d0/0d0" } }, 396 { "bat", 0, ISFLY, { XX, 1, 1, 3, ___, "1d2" } }, 397 { "centaur", 15, 0, { XX, 25, 4, 4, ___, "1d6/1d6" } }, 398 { "dragon", 100, ISMEAN, { XX,6800, 10, -1, ___, "1d8/1d8/3d10" } }, 399 { "emu", 0, ISMEAN, { XX, 2, 1, 7, ___, "1d2" } }, 400 /* NOTE: the damage is %%% so that xstr won't merge this */ 401 /* string with others, since it is written on in the program */ 402 { "venus flytrap",0, ISMEAN, { XX, 80, 8, 3, ___, "%%%d0" } }, 403 { "griffin", 20, ISMEAN|ISFLY|ISREGEN, {XX,2000, 13, 2,___, "4d3/3d5/4d3" } }, 404 { "hobgoblin", 0, ISMEAN, { XX, 3, 1, 5, ___, "1d8" } }, 405 { "ice monster", 0, ISMEAN, { XX, 15, 1, 9, ___, "1d2" } }, 406 { "jabberwock", 70, 0, { XX,4000, 15, 6, ___, "2d12/2d4" } }, 407 { "kestral", 0, ISMEAN|ISFLY, { XX, 1, 1, 7, ___, "1d4" } }, 408 { "leprechaun", ISGREED, 0, { XX, 10, 3, 8, ___, "1d2" } }, 409 { "medusa", 40, ISMEAN, { XX,200, 8, 2, ___, "3d4/3d4/2d5" } }, 410 { "nymph", 100, 0, { XX, 37, 3, 9, ___, "0d0" } }, 411 { "orc", 15, ISGREED,{ XX, 5, 1, 6, ___, "1d8" } }, 412 { "phantom", 0,ISINVIS,{ XX,120, 8, 3, ___, "4d4" } }, 413 { "quagga", 30, ISMEAN, { XX, 32, 3, 2, ___, "1d2/1d2/1d4" } }, 414 { "rattlesnake", 0, ISMEAN, { XX, 9, 2, 3, ___, "1d6" } }, 415 { "slime", 0, ISMEAN, { XX, 1, 2, 8, ___, "1d3" } }, 416 { "troll", 50, ISREGEN|ISMEAN,{ XX, 120, 6, 4, ___, "1d8/1d8/2d6" } }, 417 { "ur-vile", 0, ISMEAN, { XX,190, 7, -2, ___, "1d3/1d3/1d3/4d6" } }, 418 { "vampire", 20, ISREGEN|ISMEAN,{ XX,350, 8, 1, ___, "1d10" } }, 419 { "wraith", 0, 0, { XX, 55, 5, 4, ___, "1d6" } }, 420 { "xeroc",30, 0, { XX,100, 7, 7, ___, "3d4" } }, 421 { "yeti", 30, 0, { XX, 50, 4, 6, ___, "1d6/1d6" } }, 422 { "zombie", 0, ISMEAN, { XX, 6, 2, 8, ___, "1d8" } } 423 }; 424 char f_damage[10]; 425 #undef ___ 426 #undef XX 427 428 struct magic_item things[NUMTHINGS] = { 429 { 0, 27 }, /* potion */ 430 { 0, 30 }, /* scroll */ 431 { 0, 17 }, /* food */ 432 { 0, 8 }, /* weapon */ 433 { 0, 8 }, /* armor */ 434 { 0, 5 }, /* ring */ 435 { 0, 5 } /* stick */ 436 }; 437 438 /* 439 * Common strings 440 */ 441 char nullstr[] = ""; 442 char *typeahead = nullstr; 443 444 char *intense = " of intense white light"; 445 char *flash = "your %s gives off a flash%s"; 446 char *it = "it"; 447 char *you = "you"; 448 char *no_mem = "Not enough Memory"; 449 char *smsg = "\r\n*** Stack Overflow ***\r\n$"; 450 ÿ