Home | History | Annotate | Line # | Download | only in rogue
rogue.h revision 1.1
      1 /*
      2  * Copyright (c) 1988 The Regents of the University of California.
      3  * 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	5.6 (Berkeley) 2/28/91
     37  */
     38 
     39 /*
     40  * rogue.h
     41  *
     42  * This source herein may be modified and/or distributed by anybody who
     43  * so desires, with the following restrictions:
     44  *    1.)  This notice shall not be removed.
     45  *    2.)  Credit shall not be taken for the creation of this source.
     46  *    3.)  This code is not to be traded, sold, or used for personal
     47  *         gain or profit.
     48  */
     49 
     50 #define boolean char
     51 
     52 #define NOTHING		((unsigned short)     0)
     53 #define OBJECT		((unsigned short)    01)
     54 #define MONSTER		((unsigned short)    02)
     55 #define STAIRS		((unsigned short)    04)
     56 #define HORWALL		((unsigned short)   010)
     57 #define VERTWALL	((unsigned short)   020)
     58 #define DOOR		((unsigned short)   040)
     59 #define FLOOR		((unsigned short)  0100)
     60 #define TUNNEL		((unsigned short)  0200)
     61 #define TRAP		((unsigned short)  0400)
     62 #define HIDDEN		((unsigned short) 01000)
     63 
     64 #define ARMOR		((unsigned short)   01)
     65 #define WEAPON		((unsigned short)   02)
     66 #define SCROL		((unsigned short)   04)
     67 #define POTION		((unsigned short)  010)
     68 #define GOLD		((unsigned short)  020)
     69 #define FOOD		((unsigned short)  040)
     70 #define WAND		((unsigned short) 0100)
     71 #define RING		((unsigned short) 0200)
     72 #define AMULET		((unsigned short) 0400)
     73 #define ALL_OBJECTS	((unsigned short) 0777)
     74 
     75 #define LEATHER 0
     76 #define RINGMAIL 1
     77 #define SCALE 2
     78 #define CHAIN 3
     79 #define BANDED 4
     80 #define SPLINT 5
     81 #define PLATE 6
     82 #define ARMORS 7
     83 
     84 #define BOW 0
     85 #define DART 1
     86 #define ARROW 2
     87 #define DAGGER 3
     88 #define SHURIKEN 4
     89 #define MACE 5
     90 #define LONG_SWORD 6
     91 #define TWO_HANDED_SWORD 7
     92 #define WEAPONS 8
     93 
     94 #define MAX_PACK_COUNT 24
     95 
     96 #define PROTECT_ARMOR 0
     97 #define HOLD_MONSTER 1
     98 #define ENCH_WEAPON 2
     99 #define ENCH_ARMOR 3
    100 #define IDENTIFY 4
    101 #define TELEPORT 5
    102 #define SLEEP 6
    103 #define SCARE_MONSTER 7
    104 #define REMOVE_CURSE 8
    105 #define CREATE_MONSTER 9
    106 #define AGGRAVATE_MONSTER 10
    107 #define MAGIC_MAPPING 11
    108 #define CON_MON 12
    109 #define SCROLS 13
    110 
    111 #define INCREASE_STRENGTH 0
    112 #define RESTORE_STRENGTH 1
    113 #define HEALING 2
    114 #define EXTRA_HEALING 3
    115 #define POISON 4
    116 #define RAISE_LEVEL 5
    117 #define BLINDNESS 6
    118 #define HALLUCINATION 7
    119 #define DETECT_MONSTER 8
    120 #define DETECT_OBJECTS 9
    121 #define CONFUSION 10
    122 #define LEVITATION 11
    123 #define HASTE_SELF 12
    124 #define SEE_INVISIBLE 13
    125 #define POTIONS 14
    126 
    127 #define TELE_AWAY 0
    128 #define SLOW_MONSTER 1
    129 #define INVISIBILITY 2
    130 #define POLYMORPH 3
    131 #define HASTE_MONSTER 4
    132 #define MAGIC_MISSILE 5
    133 #define CANCELLATION 6
    134 #define DO_NOTHING 7
    135 #define DRAIN_LIFE 8
    136 #define COLD 9
    137 #define FIRE 10
    138 #define WANDS 11
    139 
    140 #define STEALTH 0
    141 #define R_TELEPORT 1
    142 #define REGENERATION 2
    143 #define SLOW_DIGEST 3
    144 #define ADD_STRENGTH 4
    145 #define SUSTAIN_STRENGTH 5
    146 #define DEXTERITY 6
    147 #define ADORNMENT 7
    148 #define R_SEE_INVISIBLE 8
    149 #define MAINTAIN_ARMOR 9
    150 #define SEARCHING 10
    151 #define RINGS 11
    152 
    153 #define RATION 0
    154 #define FRUIT 1
    155 
    156 #define NOT_USED		((unsigned short)   0)
    157 #define BEING_WIELDED	((unsigned short)  01)
    158 #define BEING_WORN		((unsigned short)  02)
    159 #define ON_LEFT_HAND	((unsigned short)  04)
    160 #define ON_RIGHT_HAND	((unsigned short) 010)
    161 #define ON_EITHER_HAND	((unsigned short) 014)
    162 #define BEING_USED		((unsigned short) 017)
    163 
    164 #define NO_TRAP -1
    165 #define TRAP_DOOR 0
    166 #define BEAR_TRAP 1
    167 #define TELE_TRAP 2
    168 #define DART_TRAP 3
    169 #define SLEEPING_GAS_TRAP 4
    170 #define RUST_TRAP 5
    171 #define TRAPS 6
    172 
    173 #define STEALTH_FACTOR 3
    174 #define R_TELE_PERCENT 8
    175 
    176 #define UNIDENTIFIED ((unsigned short) 00)	/* MUST BE ZERO! */
    177 #define IDENTIFIED ((unsigned short) 01)
    178 #define CALLED ((unsigned short) 02)
    179 
    180 #define DROWS 24
    181 #define DCOLS 80
    182 #define NMESSAGES 5
    183 #define MAX_TITLE_LENGTH 30
    184 #define MAXSYLLABLES 40
    185 #define MAX_METAL 14
    186 #define WAND_MATERIALS 30
    187 #define GEMS 14
    188 
    189 #define GOLD_PERCENT 46
    190 
    191 #define MAX_OPT_LEN 40
    192 
    193 struct id {
    194 	short value;
    195 	char *title;
    196 	char *real;
    197 	unsigned short id_status;
    198 };
    199 
    200 /* The following #defines provide more meaningful names for some of the
    201  * struct object fields that are used for monsters.  This, since each monster
    202  * and object (scrolls, potions, etc) are represented by a struct object.
    203  * Ideally, this should be handled by some kind of union structure.
    204  */
    205 
    206 #define m_damage damage
    207 #define hp_to_kill quantity
    208 #define m_char ichar
    209 #define first_level is_protected
    210 #define last_level is_cursed
    211 #define m_hit_chance class
    212 #define stationary_damage identified
    213 #define drop_percent which_kind
    214 #define trail_char d_enchant
    215 #define slowed_toggle quiver
    216 #define moves_confused hit_enchant
    217 #define nap_length picked_up
    218 #define disguise what_is
    219 #define next_monster next_object
    220 
    221 struct obj {				/* comment is monster meaning */
    222 	unsigned long m_flags;	/* monster flags */
    223 	char *damage;			/* damage it does */
    224 	short quantity;			/* hit points to kill */
    225 	short ichar;			/* 'A' is for aquatar */
    226 	short kill_exp;			/* exp for killing it */
    227 	short is_protected;		/* level starts */
    228 	short is_cursed;		/* level ends */
    229 	short class;			/* chance of hitting you */
    230 	short identified;		/* 'F' damage, 1,2,3... */
    231 	unsigned short which_kind; /* item carry/drop % */
    232 	short o_row, o_col, o;	/* o is how many times stuck at o_row, o_col */
    233 	short row, col;			/* current row, col */
    234 	short d_enchant;		/* room char when detect_monster */
    235 	short quiver;			/* monster slowed toggle */
    236 	short trow, tcol;		/* target row, col */
    237 	short hit_enchant;		/* how many moves is confused */
    238 	unsigned short what_is;	/* imitator's charactor (?!%: */
    239 	short picked_up;		/* sleep from wand of sleep */
    240 	unsigned short in_use_flags;
    241 	struct obj *next_object;	/* next monster */
    242 };
    243 
    244 typedef struct obj object;
    245 
    246 #define INIT_AW (object*)0,(object*)0
    247 #define INIT_RINGS (object*)0,(object*)0
    248 #define INIT_HP 12,12
    249 #define INIT_STR 16,16
    250 #define INIT_EXP 1,0
    251 #define INIT_PACK {0}
    252 #define INIT_GOLD 0
    253 #define INIT_CHAR '@'
    254 #define INIT_MOVES 1250
    255 
    256 struct fightr {
    257 	object *armor;
    258 	object *weapon;
    259 	object *left_ring, *right_ring;
    260 	short hp_current;
    261 	short hp_max;
    262 	short str_current;
    263 	short str_max;
    264 	object pack;
    265 	long gold;
    266 	short exp;
    267 	long exp_points;
    268 	short row, col;
    269 	short fchar;
    270 	short moves_left;
    271 };
    272 
    273 typedef struct fightr fighter;
    274 
    275 struct dr {
    276 	short oth_room;
    277 	short oth_row,
    278 	      oth_col;
    279 	short door_row,
    280 		  door_col;
    281 };
    282 
    283 typedef struct dr door;
    284 
    285 struct rm {
    286 	short bottom_row, right_col, left_col, top_row;
    287 	door doors[4];
    288 	unsigned short is_room;
    289 };
    290 
    291 typedef struct rm room;
    292 
    293 #define MAXROOMS 9
    294 #define BIG_ROOM 10
    295 
    296 #define NO_ROOM -1
    297 
    298 #define PASSAGE -3		/* cur_room value */
    299 
    300 #define AMULET_LEVEL 26
    301 
    302 #define R_NOTHING	((unsigned short) 01)
    303 #define R_ROOM		((unsigned short) 02)
    304 #define R_MAZE		((unsigned short) 04)
    305 #define R_DEADEND	((unsigned short) 010)
    306 #define R_CROSS		((unsigned short) 020)
    307 
    308 #define MAX_EXP_LEVEL 21
    309 #define MAX_EXP 10000001L
    310 #define MAX_GOLD 999999
    311 #define MAX_ARMOR 99
    312 #define MAX_HP 999
    313 #define MAX_STRENGTH 99
    314 #define LAST_DUNGEON 99
    315 
    316 #define STAT_LEVEL 01
    317 #define STAT_GOLD 02
    318 #define STAT_HP 04
    319 #define STAT_STRENGTH 010
    320 #define STAT_ARMOR 020
    321 #define STAT_EXP 040
    322 #define STAT_HUNGER 0100
    323 #define STAT_LABEL 0200
    324 #define STAT_ALL 0377
    325 
    326 #define PARTY_TIME 10	/* one party somewhere in each 10 level span */
    327 
    328 #define MAX_TRAPS 10	/* maximum traps per level */
    329 
    330 #define HIDE_PERCENT 12
    331 
    332 struct tr {
    333 	short trap_type;
    334 	short trap_row, trap_col;
    335 };
    336 
    337 typedef struct tr trap;
    338 
    339 extern fighter rogue;
    340 extern room rooms[];
    341 extern trap traps[];
    342 extern unsigned short dungeon[DROWS][DCOLS];
    343 extern object level_objects;
    344 
    345 extern struct id id_scrolls[];
    346 extern struct id id_potions[];
    347 extern struct id id_wands[];
    348 extern struct id id_rings[];
    349 extern struct id id_weapons[];
    350 extern struct id id_armors[];
    351 
    352 extern object mon_tab[];
    353 extern object level_monsters;
    354 
    355 #define MONSTERS 26
    356 
    357 #define HASTED					01L
    358 #define SLOWED					02L
    359 #define INVISIBLE				04L
    360 #define ASLEEP				   010L
    361 #define WAKENS				   020L
    362 #define WANDERS				   040L
    363 #define FLIES				  0100L
    364 #define FLITS				  0200L
    365 #define CAN_FLIT			  0400L		/* can, but usually doesn't, flit */
    366 #define CONFUSED	 		 01000L
    367 #define RUSTS				 02000L
    368 #define HOLDS				 04000L
    369 #define FREEZES				010000L
    370 #define STEALS_GOLD			020000L
    371 #define STEALS_ITEM			040000L
    372 #define STINGS			   0100000L
    373 #define DRAINS_LIFE		   0200000L
    374 #define DROPS_LEVEL		   0400000L
    375 #define SEEKS_GOLD		  01000000L
    376 #define FREEZING_ROGUE	  02000000L
    377 #define RUST_VANISHED	  04000000L
    378 #define CONFUSES		 010000000L
    379 #define IMITATES		 020000000L
    380 #define FLAMES			 040000000L
    381 #define STATIONARY		0100000000L		/* damage will be 1,2,3,... */
    382 #define NAPPING			0200000000L		/* can't wake up for a while */
    383 #define ALREADY_MOVED	0400000000L
    384 
    385 #define SPECIAL_HIT		(RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
    386 
    387 #define WAKE_PERCENT 45
    388 #define FLIT_PERCENT 40
    389 #define PARTY_WAKE_PERCENT 75
    390 
    391 #define HYPOTHERMIA 1
    392 #define STARVATION 2
    393 #define POISON_DART 3
    394 #define QUIT 4
    395 #define WIN 5
    396 #define KFIRE 6
    397 
    398 #define UPWARD 0
    399 #define UPRIGHT 1
    400 #define RIGHT 2
    401 #define DOWNRIGHT 3
    402 #define DOWN 4
    403 #define DOWNLEFT 5
    404 #define LEFT 6
    405 #define UPLEFT 7
    406 #define DIRS 8
    407 
    408 #define ROW1 7
    409 #define ROW2 15
    410 
    411 #define COL1 26
    412 #define COL2 52
    413 
    414 #define MOVED 0
    415 #define MOVE_FAILED -1
    416 #define STOPPED_ON_SOMETHING -2
    417 #define CANCEL '\033'
    418 #define LIST '*'
    419 
    420 #define HUNGRY 300
    421 #define WEAK 150
    422 #define FAINT 20
    423 #define STARVE 0
    424 
    425 #define MIN_ROW 1
    426 
    427 /* external routine declarations.
    428  */
    429 char *strcpy();
    430 char *strncpy();
    431 char *strcat();
    432 
    433 char *mon_name();
    434 char *get_ench_color();
    435 char *name_of();
    436 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 long rrandom();
    461 long lget_number();
    462 long xxx();
    463 void byebye(), onintr(), error_save();
    464 
    465 struct rogue_time {
    466 	short year;		/* >= 1987 */
    467 	short month;	/* 1 - 12 */
    468 	short day;		/* 1 - 31 */
    469 	short hour;		/* 0 - 23 */
    470 	short minute;	/* 0 - 59 */
    471 	short second;	/* 0 - 59 */
    472 };
    473 
    474 #ifdef CURSES
    475 struct _win_st {
    476 	short _cury, _curx;
    477 	short _maxy, _maxx;
    478 };
    479 
    480 typedef struct _win_st WINDOW;
    481 
    482 extern int LINES, COLS;
    483 extern WINDOW *curscr;
    484 extern char *CL;
    485 
    486 char *md_gdtcf();
    487 
    488 #else
    489 #include <curses.h>
    490 #endif
    491