1 /* 2 * Copyright (c) 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Timoth C. Stoehr. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. All advertising materials mentioning features or use of this software 17 * must display the following acknowledgement: 18 * This product includes software developed by the University of 19 * California, Berkeley and its contributors. 20 * 4. Neither the name of the University nor the names of its contributors 21 * may be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)rogue.h 8.1 (Berkeley) 5/31/93 37 * $FreeBSD: src/games/rogue/rogue.h,v 1.3.2.1 2001/12/17 12:43:23 phantom Exp $ 38 */ 39 40 #include <curses.h> 41 #include <string.h> 42 43 /* 44 * rogue.h 45 * 46 * This source herein may be modified and/or distributed by anybody who 47 * so desires, with the following restrictions: 48 * 1.) This notice shall not be removed. 49 * 2.) Credit shall not be taken for the creation of this source. 50 * 3.) This code is not to be traded, sold, or used for personal 51 * gain or profit. 52 */ 53 54 #define boolean char 55 56 #define NOTHING ((unsigned short) 0) 57 #define OBJECT ((unsigned short) 01) 58 #define MONSTER ((unsigned short) 02) 59 #define STAIRS ((unsigned short) 04) 60 #define HORWALL ((unsigned short) 010) 61 #define VERTWALL ((unsigned short) 020) 62 #define DOOR ((unsigned short) 040) 63 #define FLOOR ((unsigned short) 0100) 64 #define TUNNEL ((unsigned short) 0200) 65 #define TRAP ((unsigned short) 0400) 66 #define HIDDEN ((unsigned short) 01000) 67 68 #define ARMOR ((unsigned short) 01) 69 #define WEAPON ((unsigned short) 02) 70 #define SCROL ((unsigned short) 04) 71 #define POTION ((unsigned short) 010) 72 #define GOLD ((unsigned short) 020) 73 #define FOOD ((unsigned short) 040) 74 #define WAND ((unsigned short) 0100) 75 #define RING ((unsigned short) 0200) 76 #define AMULET ((unsigned short) 0400) 77 #define ALL_OBJECTS ((unsigned short) 0777) 78 79 #define LEATHER 0 80 #define RINGMAIL 1 81 #define SCALE 2 82 #define CHAIN 3 83 #define BANDED 4 84 #define SPLINT 5 85 #define PLATE 6 86 #define ARMORS 7 87 88 #define BOW 0 89 #define DART 1 90 #define ARROW 2 91 #define DAGGER 3 92 #define SHURIKEN 4 93 #define MACE 5 94 #define LONG_SWORD 6 95 #define TWO_HANDED_SWORD 7 96 #define WEAPONS 8 97 98 #define MAX_PACK_COUNT 24 99 100 #define PROTECT_ARMOR 0 101 #define HOLD_MONSTER 1 102 #define ENCH_WEAPON 2 103 #define ENCH_ARMOR 3 104 #define IDENTIFY 4 105 #define TELEPORT 5 106 #define SLEEP 6 107 #define SCARE_MONSTER 7 108 #define REMOVE_CURSE 8 109 #define CREATE_MONSTER 9 110 #define AGGRAVATE_MONSTER 10 111 #define MAGIC_MAPPING 11 112 #define CON_MON 12 113 #define SCROLS 13 114 115 #define INCREASE_STRENGTH 0 116 #define RESTORE_STRENGTH 1 117 #define HEALING 2 118 #define EXTRA_HEALING 3 119 #define POISON 4 120 #define RAISE_LEVEL 5 121 #define BLINDNESS 6 122 #define HALLUCINATION 7 123 #define DETECT_MONSTER 8 124 #define DETECT_OBJECTS 9 125 #define CONFUSION 10 126 #define LEVITATION 11 127 #define HASTE_SELF 12 128 #define SEE_INVISIBLE 13 129 #define POTIONS 14 130 131 #define TELE_AWAY 0 132 #define SLOW_MONSTER 1 133 #define INVISIBILITY 2 134 #define POLYMORPH 3 135 #define HASTE_MONSTER 4 136 #define MAGIC_MISSILE 5 137 #define CANCELLATION 6 138 #define DO_NOTHING 7 139 #define DRAIN_LIFE 8 140 #define COLD 9 141 #define FIRE 10 142 #define WANDS 11 143 144 #define STEALTH 0 145 #define R_TELEPORT 1 146 #define REGENERATION 2 147 #define SLOW_DIGEST 3 148 #define ADD_STRENGTH 4 149 #define SUSTAIN_STRENGTH 5 150 #define DEXTERITY 6 151 #define ADORNMENT 7 152 #define R_SEE_INVISIBLE 8 153 #define MAINTAIN_ARMOR 9 154 #define SEARCHING 10 155 #define RINGS 11 156 157 #define RATION 0 158 #define FRUIT 1 159 160 #define NOT_USED ((unsigned short) 0) 161 #define BEING_WIELDED ((unsigned short) 01) 162 #define BEING_WORN ((unsigned short) 02) 163 #define ON_LEFT_HAND ((unsigned short) 04) 164 #define ON_RIGHT_HAND ((unsigned short) 010) 165 #define ON_EITHER_HAND ((unsigned short) 014) 166 #define BEING_USED ((unsigned short) 017) 167 168 #define NO_TRAP -1 169 #define TRAP_DOOR 0 170 #define BEAR_TRAP 1 171 #define TELE_TRAP 2 172 #define DART_TRAP 3 173 #define SLEEPING_GAS_TRAP 4 174 #define RUST_TRAP 5 175 #define TRAPS 6 176 177 #define STEALTH_FACTOR 3 178 #define R_TELE_PERCENT 8 179 180 #define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */ 181 #define IDENTIFIED ((unsigned short) 01) 182 #define CALLED ((unsigned short) 02) 183 184 #define DROWS 24 185 #define DCOLS 80 186 #define NMESSAGES 5 187 #define MAX_TITLE_LENGTH 30 188 #define MAXSYLLABLES 40 189 #define MAX_METAL 14 190 #define WAND_MATERIALS 30 191 #define GEMS 14 192 193 #define GOLD_PERCENT 46 194 195 #define MAX_OPT_LEN 40 196 197 struct id { 198 short value; 199 char *title; 200 char *real; 201 unsigned short id_status; 202 }; 203 204 /* The following #defines provide more meaningful names for some of the 205 * struct object fields that are used for monsters. This, since each monster 206 * and object (scrolls, potions, etc) are represented by a struct object. 207 * Ideally, this should be handled by some kind of union structure. 208 */ 209 210 #define m_damage damage 211 #define hp_to_kill quantity 212 #define m_char ichar 213 #define first_level is_protected 214 #define last_level is_cursed 215 #define m_hit_chance class 216 #define stationary_damage identified 217 #define drop_percent which_kind 218 #define trail_char d_enchant 219 #define slowed_toggle quiver 220 #define moves_confused hit_enchant 221 #define nap_length picked_up 222 #define disguise what_is 223 #define next_monster next_object 224 225 struct obj { /* comment is monster meaning */ 226 unsigned long m_flags; /* monster flags */ 227 const char *damage; /* damage it does */ 228 short quantity; /* hit points to kill */ 229 short ichar; /* 'A' is for aquatar */ 230 short kill_exp; /* exp for killing it */ 231 short is_protected; /* level starts */ 232 short is_cursed; /* level ends */ 233 short class; /* chance of hitting you */ 234 short identified; /* 'F' damage, 1,2,3... */ 235 unsigned short which_kind; /* item carry/drop % */ 236 short o_row, o_col, o; /* o is how many times stuck at o_row, o_col */ 237 short row, col; /* current row, col */ 238 short d_enchant; /* room char when detect_monster */ 239 short quiver; /* monster slowed toggle */ 240 short trow, tcol; /* target row, col */ 241 short hit_enchant; /* how many moves is confused */ 242 unsigned short what_is; /* imitator's charactor (?!%: */ 243 short picked_up; /* sleep from wand of sleep */ 244 unsigned short in_use_flags; 245 struct obj *next_object; /* next monster */ 246 }; 247 248 typedef struct obj object; 249 250 #define INIT_AW (object*)0,(object*)0 251 #define INIT_RINGS (object*)0,(object*)0 252 #define INIT_HP 12,12 253 #define INIT_STR 16,16 254 #define INIT_EXP 1,0 255 #define INIT_PACK {0} 256 #define INIT_GOLD 0 257 #define INIT_CHAR '@' 258 #define INIT_MOVES 1250 259 260 struct fightr { 261 object *armor; 262 object *weapon; 263 object *left_ring, *right_ring; 264 short hp_current; 265 short hp_max; 266 short str_current; 267 short str_max; 268 object pack; 269 long gold; 270 short exp; 271 long exp_points; 272 short row, col; 273 short fchar; 274 short moves_left; 275 }; 276 277 typedef struct fightr fighter; 278 279 struct dr { 280 short oth_room; 281 short oth_row, 282 oth_col; 283 short door_row, 284 door_col; 285 }; 286 287 typedef struct dr door; 288 289 struct rm { 290 short bottom_row, right_col, left_col, top_row; 291 door doors[4]; 292 unsigned short is_room; 293 }; 294 295 typedef struct rm room; 296 297 #define MAXROOMS 9 298 #define BIG_ROOM 10 299 300 #define NO_ROOM -1 301 302 #define PASSAGE -3 /* cur_room value */ 303 304 #define AMULET_LEVEL 26 305 306 #define R_NOTHING ((unsigned short) 01) 307 #define R_ROOM ((unsigned short) 02) 308 #define R_MAZE ((unsigned short) 04) 309 #define R_DEADEND ((unsigned short) 010) 310 #define R_CROSS ((unsigned short) 020) 311 312 #define MAX_EXP_LEVEL 21 313 #define MAX_EXP 10000001L 314 #define MAX_GOLD 999999 315 #define MAX_ARMOR 99 316 #define MAX_HP 999 317 #define MAX_STRENGTH 99 318 #define LAST_DUNGEON 99 319 320 #define STAT_LEVEL 01 321 #define STAT_GOLD 02 322 #define STAT_HP 04 323 #define STAT_STRENGTH 010 324 #define STAT_ARMOR 020 325 #define STAT_EXP 040 326 #define STAT_HUNGER 0100 327 #define STAT_LABEL 0200 328 #define STAT_ALL 0377 329 330 #define PARTY_TIME 10 /* one party somewhere in each 10 level span */ 331 332 #define MAX_TRAPS 10 /* maximum traps per level */ 333 334 #define HIDE_PERCENT 12 335 336 struct tr { 337 short trap_type; 338 short trap_row, trap_col; 339 }; 340 341 typedef struct tr trap; 342 343 extern fighter rogue; 344 extern room rooms[]; 345 extern trap traps[]; 346 extern unsigned short dungeon[DROWS][DCOLS]; 347 extern object level_objects; 348 349 extern struct id id_scrolls[]; 350 extern struct id id_potions[]; 351 extern struct id id_wands[]; 352 extern struct id id_rings[]; 353 extern struct id id_weapons[]; 354 extern struct id id_armors[]; 355 356 extern object mon_tab[]; 357 extern object level_monsters; 358 359 #define MONSTERS 26 360 361 #define HASTED 01L 362 #define SLOWED 02L 363 #define INVISIBLE 04L 364 #define ASLEEP 010L 365 #define WAKENS 020L 366 #define WANDERS 040L 367 #define FLIES 0100L 368 #define FLITS 0200L 369 #define CAN_FLIT 0400L /* can, but usually doesn't, flit */ 370 #define CONFUSED 01000L 371 #define RUSTS 02000L 372 #define HOLDS 04000L 373 #define FREEZES 010000L 374 #define STEALS_GOLD 020000L 375 #define STEALS_ITEM 040000L 376 #define STINGS 0100000L 377 #define DRAINS_LIFE 0200000L 378 #define DROPS_LEVEL 0400000L 379 #define SEEKS_GOLD 01000000L 380 #define FREEZING_ROGUE 02000000L 381 #define RUST_VANISHED 04000000L 382 #define CONFUSES 010000000L 383 #define IMITATES 020000000L 384 #define FLAMES 040000000L 385 #define STATIONARY 0100000000L /* damage will be 1,2,3,... */ 386 #define NAPPING 0200000000L /* can't wake up for a while */ 387 #define ALREADY_MOVED 0400000000L 388 389 #define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL) 390 391 #define WAKE_PERCENT 45 392 #define FLIT_PERCENT 40 393 #define PARTY_WAKE_PERCENT 75 394 395 #define HYPOTHERMIA 1 396 #define STARVATION 2 397 #define POISON_DART 3 398 #define QUIT 4 399 #define WIN 5 400 #define KFIRE 6 401 402 #define UPWARD 0 403 #define UPRIGHT 1 404 #define RIGHT 2 405 #define DOWNRIGHT 3 406 #define DOWN 4 407 #define DOWNLEFT 5 408 #define LEFT 6 409 #define UPLEFT 7 410 #define DIRS 8 411 412 #define ROW1 7 413 #define ROW2 15 414 415 #define COL1 26 416 #define COL2 52 417 418 #define MOVED 0 419 #define MOVE_FAILED -1 420 #define STOPPED_ON_SOMETHING -2 421 #define CANCEL '\033' 422 #define LIST '*' 423 424 #define HUNGRY 300 425 #define WEAK 150 426 #define FAINT 20 427 #define STARVE 0 428 429 #define MIN_ROW 1 430 431 /* external routine declarations. 432 */ 433 const char *mon_name(); 434 const char *get_ench_color(); 435 const char *name_of(); 436 const char *md_gln(); 437 char *md_getenv(); 438 char *md_malloc(); 439 boolean is_direction(); 440 boolean mon_sees(); 441 boolean mask_pack(); 442 boolean mask_room(); 443 boolean is_digit(); 444 boolean check_hunger(); 445 boolean reg_move(); 446 boolean md_df(); 447 boolean has_been_touched(); 448 object *add_to_pack(); 449 object *alloc_object(); 450 object *get_letter_object(); 451 object *gr_monster(); 452 object *get_thrown_at_monster(); 453 object *get_zapped_monster(); 454 object *check_duplicate(); 455 object *gr_object(); 456 object *object_at(); 457 object *pick_up(); 458 struct id *get_id_table(); 459 unsigned short gr_what_is(); 460 #define rrandom random 461 #define srrandom(x) srandomdev() 462 long lget_number(); 463 long xxx(); 464 void byebye(), onintr(), error_save(); 465 466 struct rogue_time { 467 short year; /* >= 1987 */ 468 short month; /* 1 - 12 */ 469 short day; /* 1 - 31 */ 470 short hour; /* 0 - 23 */ 471 short minute; /* 0 - 59 */ 472 short second; /* 0 - 59 */ 473 }; 474 475