acpi: Narrow workaround for broken interrupt settings
[dragonfly.git] / games / rogue / rogue.h
blobe82e24cc907fdf916cadee8e63ce826306eebf2a
1 /*-
2 * Copyright (c) 1988, 1993
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
6 * Timothy C. Stoehr.
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. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
32 * @(#)rogue.h 8.1 (Berkeley) 5/31/93
33 * $FreeBSD: src/games/rogue/rogue.h,v 1.3.2.1 2001/12/17 12:43:23 phantom Exp $
36 #include <curses.h>
37 #include <stdbool.h>
38 #include <stdlib.h>
39 #include <string.h>
42 * rogue.h
44 * This source herein may be modified and/or distributed by anybody who
45 * so desires, with the following restrictions:
46 * 1.) This notice shall not be removed.
47 * 2.) Credit shall not be taken for the creation of this source.
48 * 3.) This code is not to be traded, sold, or used for personal
49 * gain or profit.
52 #define boolean bool
54 #define NOTHING ((unsigned short) 0)
55 #define OBJECT ((unsigned short) 01)
56 #define MONSTER ((unsigned short) 02)
57 #define STAIRS ((unsigned short) 04)
58 #define HORWALL ((unsigned short) 010)
59 #define VERTWALL ((unsigned short) 020)
60 #define DOOR ((unsigned short) 040)
61 #define FLOOR ((unsigned short) 0100)
62 #define TUNNEL ((unsigned short) 0200)
63 #define TRAP ((unsigned short) 0400)
64 #define HIDDEN ((unsigned short) 01000)
66 #define ARMOR ((unsigned short) 01)
67 #define WEAPON ((unsigned short) 02)
68 #define SCROL ((unsigned short) 04)
69 #define POTION ((unsigned short) 010)
70 #define GOLD ((unsigned short) 020)
71 #define FOOD ((unsigned short) 040)
72 #define WAND ((unsigned short) 0100)
73 #define RING ((unsigned short) 0200)
74 #define AMULET ((unsigned short) 0400)
75 #define ALL_OBJECTS ((unsigned short) 0777)
77 #define LEATHER 0
78 #define RINGMAIL 1
79 #define SCALE 2
80 #define CHAIN 3
81 #define BANDED 4
82 #define SPLINT 5
83 #define PLATE 6
84 #define ARMORS 7
86 #define BOW 0
87 #define DART 1
88 #define ARROW 2
89 #define DAGGER 3
90 #define SHURIKEN 4
91 #define MACE 5
92 #define LONG_SWORD 6
93 #define TWO_HANDED_SWORD 7
94 #define WEAPONS 8
96 #define MAX_PACK_COUNT 24
98 #define PROTECT_ARMOR 0
99 #define HOLD_MONSTER 1
100 #define ENCH_WEAPON 2
101 #define ENCH_ARMOR 3
102 #define IDENTIFY 4
103 #define TELEPORT 5
104 #define SLEEP 6
105 #define SCARE_MONSTER 7
106 #define REMOVE_CURSE 8
107 #define CREATE_MONSTER 9
108 #define AGGRAVATE_MONSTER 10
109 #define MAGIC_MAPPING 11
110 #define CON_MON 12
111 #define SCROLS 13
113 #define INCREASE_STRENGTH 0
114 #define RESTORE_STRENGTH 1
115 #define HEALING 2
116 #define EXTRA_HEALING 3
117 #define POISON 4
118 #define RAISE_LEVEL 5
119 #define BLINDNESS 6
120 #define HALLUCINATION 7
121 #define DETECT_MONSTER 8
122 #define DETECT_OBJECTS 9
123 #define CONFUSION 10
124 #define LEVITATION 11
125 #define HASTE_SELF 12
126 #define SEE_INVISIBLE 13
127 #define POTIONS 14
129 #define TELE_AWAY 0
130 #define SLOW_MONSTER 1
131 #define INVISIBILITY 2
132 #define POLYMORPH 3
133 #define HASTE_MONSTER 4
134 #define MAGIC_MISSILE 5
135 #define CANCELLATION 6
136 #define DO_NOTHING 7
137 #define DRAIN_LIFE 8
138 #define COLD 9
139 #define FIRE 10
140 #define WANDS 11
142 #define STEALTH 0
143 #define R_TELEPORT 1
144 #define REGENERATION 2
145 #define SLOW_DIGEST 3
146 #define ADD_STRENGTH 4
147 #define SUSTAIN_STRENGTH 5
148 #define DEXTERITY 6
149 #define ADORNMENT 7
150 #define R_SEE_INVISIBLE 8
151 #define MAINTAIN_ARMOR 9
152 #define SEARCHING 10
153 #define RINGS 11
155 #define RATION 0
156 #define FRUIT 1
158 #define NOT_USED ((unsigned short) 0)
159 #define BEING_WIELDED ((unsigned short) 01)
160 #define BEING_WORN ((unsigned short) 02)
161 #define ON_LEFT_HAND ((unsigned short) 04)
162 #define ON_RIGHT_HAND ((unsigned short) 010)
163 #define ON_EITHER_HAND ((unsigned short) 014)
164 #define BEING_USED ((unsigned short) 017)
166 #define NO_TRAP -1
167 #define TRAP_DOOR 0
168 #define BEAR_TRAP 1
169 #define TELE_TRAP 2
170 #define DART_TRAP 3
171 #define SLEEPING_GAS_TRAP 4
172 #define RUST_TRAP 5
173 #define TRAPS 6
175 #define STEALTH_FACTOR 3
176 #define R_TELE_PERCENT 8
178 #define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */
179 #define IDENTIFIED ((unsigned short) 01)
180 #define CALLED ((unsigned short) 02)
182 #define DROWS 24
183 #define DCOLS 80
184 #define NMESSAGES 5
185 #define MAX_TITLE_LENGTH 30
186 #define MAXSYLLABLES 40
187 #define MAX_METAL 14
188 #define WAND_MATERIALS 30
189 #define GEMS 14
191 #define GOLD_PERCENT 46
193 #define MAX_OPT_LEN 40
195 #define HIT_MESSAGE_SIZE 80
197 #define HUNGER_STR_LEN 8
199 #define MAX_ID_TITLE_LEN 64
201 struct id {
202 short value;
203 char title[MAX_ID_TITLE_LEN];
204 const char *real;
205 unsigned short id_status;
208 /* The following #defines provide more meaningful names for some of the
209 * struct object fields that are used for monsters. This, since each monster
210 * and object (scrolls, potions, etc) are represented by a struct object.
211 * Ideally, this should be handled by some kind of union structure.
214 #define m_damage damage
215 #define hp_to_kill quantity
216 #define m_char ichar
217 #define first_level is_protected
218 #define last_level is_cursed
219 #define m_hit_chance class
220 #define stationary_damage identified
221 #define drop_percent which_kind
222 #define trail_char d_enchant
223 #define slowed_toggle quiver
224 #define moves_confused hit_enchant
225 #define nap_length picked_up
226 #define disguise what_is
227 #define next_monster next_object
229 struct obj { /* comment is monster meaning */
230 unsigned long m_flags; /* monster flags */
231 const char *damage; /* damage it does */
232 short quantity; /* hit points to kill */
233 short ichar; /* 'A' is for aquator */
234 short kill_exp; /* exp for killing it */
235 short is_protected; /* level starts */
236 short is_cursed; /* level ends */
237 short class; /* chance of hitting you */
238 short identified; /* 'F' damage, 1,2,3... */
239 unsigned short which_kind; /* item carry/drop % */
240 short o_row, o_col, o; /* o is how many times stuck at o_row, o_col */
241 short row, col; /* current row, col */
242 short d_enchant; /* room char when detect_monster */
243 short quiver; /* monster slowed toggle */
244 short trow, tcol; /* target row, col */
245 short hit_enchant; /* how many moves is confused */
246 unsigned short what_is; /* imitator's charactor (?!%: */
247 short picked_up; /* sleep from wand of sleep */
248 unsigned short in_use_flags;
249 struct obj *next_object; /* next monster */
252 typedef struct obj object;
254 #define INIT_AW NULL,NULL
255 #define INIT_RINGS NULL,NULL
256 #define INIT_HP 12
257 #define INIT_STR 16,16
258 #define INIT_EXP 1,0
259 #define INIT_PACK {0,"",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL}
260 #define INIT_GOLD 0
261 #define INIT_CHAR '@'
262 #define INIT_MOVES 1250
264 struct fightr {
265 object *armor;
266 object *weapon;
267 object *left_ring, *right_ring;
268 short hp_current;
269 short hp_max;
270 short str_current;
271 short str_max;
272 object pack;
273 long gold;
274 short exp;
275 long exp_points;
276 short row, col;
277 short fchar;
278 short moves_left;
281 typedef struct fightr fighter;
283 struct dr {
284 short oth_room;
285 short oth_row,
286 oth_col;
287 short door_row,
288 door_col;
291 typedef struct dr door;
293 struct rm {
294 short bottom_row, right_col, left_col, top_row;
295 door doors[4];
296 unsigned short is_room;
299 typedef struct rm room;
301 #define MAXROOMS 9
302 #define BIG_ROOM 10
304 #define NO_ROOM (-1)
306 #define PASSAGE (-3) /* cur_room value */
308 #define AMULET_LEVEL 26
310 #define R_NOTHING ((unsigned short) 01)
311 #define R_ROOM ((unsigned short) 02)
312 #define R_MAZE ((unsigned short) 04)
313 #define R_DEADEND ((unsigned short) 010)
314 #define R_CROSS ((unsigned short) 020)
316 #define MAX_EXP_LEVEL 21
317 #define MAX_EXP 10000001L
318 #define MAX_GOLD 999999
319 #define MAX_ARMOR 99
320 #define MAX_HP 999
321 #define MAX_STRENGTH 99
322 #define LAST_DUNGEON 99
324 #define STAT_LEVEL 01
325 #define STAT_GOLD 02
326 #define STAT_HP 04
327 #define STAT_STRENGTH 010
328 #define STAT_ARMOR 020
329 #define STAT_EXP 040
330 #define STAT_HUNGER 0100
331 #define STAT_LABEL 0200
332 #define STAT_ALL 0377
334 #define PARTY_TIME 10 /* one party somewhere in each 10 level span */
336 #define MAX_TRAPS 10 /* maximum traps per level */
338 #define HIDE_PERCENT 12
340 struct tr {
341 short trap_type;
342 short trap_row, trap_col;
345 typedef struct tr trap;
347 extern fighter rogue;
348 extern room rooms[];
349 extern trap traps[];
350 extern unsigned short dungeon[DROWS][DCOLS];
351 extern object level_objects;
353 extern struct id id_scrolls[];
354 extern struct id id_potions[];
355 extern struct id id_wands[];
356 extern struct id id_rings[];
357 extern struct id id_weapons[];
358 extern struct id id_armors[];
360 extern object level_monsters;
362 #define MONSTERS 26
364 #define HASTED 01L
365 #define SLOWED 02L
366 #define INVISIBLE 04L
367 #define ASLEEP 010L
368 #define WAKENS 020L
369 #define WANDERS 040L
370 #define FLIES 0100L
371 #define FLITS 0200L
372 #define CAN_FLIT 0400L /* can, but usually doesn't, flit */
373 #define CONFUSED 01000L
374 #define RUSTS 02000L
375 #define HOLDS 04000L
376 #define FREEZES 010000L
377 #define STEALS_GOLD 020000L
378 #define STEALS_ITEM 040000L
379 #define STINGS 0100000L
380 #define DRAINS_LIFE 0200000L
381 #define DROPS_LEVEL 0400000L
382 #define SEEKS_GOLD 01000000L
383 #define FREEZING_ROGUE 02000000L
384 #define RUST_VANISHED 04000000L
385 #define CONFUSES 010000000L
386 #define IMITATES 020000000L
387 #define FLAMES 040000000L
388 #define STATIONARY 0100000000L /* damage will be 1,2,3,... */
389 #define NAPPING 0200000000L /* can't wake up for a while */
390 #define ALREADY_MOVED 0400000000L
392 #define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
394 #define WAKE_PERCENT 45
395 #define FLIT_PERCENT 40
396 #define PARTY_WAKE_PERCENT 75
398 #define HYPOTHERMIA 1
399 #define STARVATION 2
400 #define POISON_DART 3
401 #define QUIT 4
402 #define WIN 5
403 #define KFIRE 6
405 #define UPWARD 0
406 #define UPRIGHT 1
407 #define RIGHT 2
408 #define DOWNRIGHT 3
409 #define DOWN 4
410 #define DOWNLEFT 5
411 #define LEFT 6
412 #define UPLEFT 7
413 #define DIRS 8
415 #define ROW1 7
416 #define ROW2 15
418 #define COL1 26
419 #define COL2 52
421 #define MOVED 0
422 #define MOVE_FAILED -1
423 #define STOPPED_ON_SOMETHING -2
424 #define CANCEL '\033'
425 #define LIST '*'
427 #define HUNGRY 300
428 #define WEAK 150
429 #define FAINT 20
430 #define STARVE 0
432 #define MIN_ROW 1
434 struct rogue_time {
435 short year; /* >= 1987 */
436 short month; /* 1 - 12 */
437 short day; /* 1 - 31 */
438 short hour; /* 0 - 23 */
439 short minute; /* 0 - 59 */
440 short second; /* 0 - 59 */
444 * external routine declarations.
446 #define rrandom random
448 /* hit.c */
449 void mon_hit(object *);
450 void rogue_hit(object *, boolean);
451 void rogue_damage(short, object *, short);
452 int get_damage(const char *, boolean);
453 int get_number(const char *);
454 long lget_number(const char *);
455 boolean mon_damage(object *, short);
456 void fight(boolean);
457 void get_dir_rc(short, short *, short *, short);
458 short get_hit_chance(const object *);
459 short get_weapon_damage(const object *);
460 void s_con_mon(object *);
462 /* init.c */
463 boolean init(int, char**);
464 void clean_up(const char *) __dead2;
465 void start_window(void);
466 void stop_window(void);
467 void byebye(int);
468 void onintr(int);
469 void error_save(int) __dead2;
471 /* inventory.c */
472 void inventory(const object *, unsigned short);
473 void id_com(void);
474 void mix_colors(void);
475 void make_scroll_titles(void);
476 void get_desc(const object *, char *);
477 void get_wand_and_ring_materials(void);
478 void single_inv(short);
479 struct id *get_id_table(const object *);
480 void inv_armor_weapon(boolean);
481 void id_type(void);
483 /* level.c */
484 void make_level(void);
485 void clear_level(void);
486 void put_player(short);
487 boolean drop_check(void);
488 boolean check_up(void);
489 void add_exp(int, boolean);
490 int hp_raise(void);
491 void show_average_hp(void);
493 /* machdep.c */
494 #ifdef UNIX
495 void md_slurp(void);
496 void md_control_keybord(boolean);
497 void md_heed_signals(void);
498 void md_ignore_signals(void);
499 int md_get_file_id(const char *);
500 int md_link_count(const char *);
501 void md_gct(struct rogue_time *);
502 void md_gfmt(const char *, struct rogue_time *);
503 boolean md_df(const char *);
504 const char *md_gln(void);
505 void md_sleep(int);
506 char *md_getenv(const char *);
507 char *md_malloc(int);
508 void md_exit(int) __dead2;
509 void md_lock(boolean);
510 void md_shell(const char *);
511 #endif
513 /* message.c */
514 void message(const char *, boolean);
515 void remessage(short);
516 void check_message(void);
517 short get_input_line(const char *, const char *, char *,
518 const char *, boolean, boolean);
519 int rgetchar(void);
520 void print_stats(int);
521 void sound_bell(void);
522 boolean is_digit(short);
523 int r_index(const char *, int, boolean);
525 /* monster.c */
526 void put_mons(void);
527 object *gr_monster(object *, int);
528 void mv_mons(void);
529 void party_monsters(int, int);
530 short gmc_row_col(int, int);
531 short gmc(object *);
532 void mv_1_monster(object *, short, short);
533 void move_mon_to(object *, short, short);
534 boolean mon_can_go(const object *, short, short);
535 void wake_up(object *);
536 void wake_room(short, boolean, short, short);
537 const char *mon_name(const object *);
538 void wanderer(void);
539 void show_monsters(void);
540 void create_monster(void);
541 int rogue_can_see(int, int);
542 char gr_obj_char(void);
543 void aggravate(void);
544 boolean mon_sees(const object *, int, int);
545 void mv_aquatars(void);
547 /* move.c */
548 short one_move_rogue(short, short);
549 void multiple_move_rogue(short);
550 boolean is_passable(int, int);
551 boolean can_move(short, short, short, short);
552 void move_onto(void);
553 boolean is_direction(short, short *);
554 boolean reg_move(void);
555 void rest(int);
557 /* object.c */
558 void put_objects(void);
559 void place_at(object *, int, int);
560 object *object_at(object *, short, short);
561 object *get_letter_object(int);
562 void free_stuff(object *);
563 const char *name_of(const object *);
564 object *gr_object(void);
565 void get_food(object *, boolean);
566 void put_stairs(void);
567 short get_armor_class(const object *);
568 object *alloc_object(void);
569 void free_object(object *);
570 void show_objects(void);
571 void put_amulet(void);
572 void c_object_for_wizard(void);
574 /* pack.c */
575 object *add_to_pack(object *, object *, int);
576 void take_from_pack(object *, object *);
577 object *pick_up(int, int, short *);
578 void drop(void);
579 void wait_for_ack(void);
580 short pack_letter(const char *, unsigned short);
581 void take_off(void);
582 void wear(void);
583 void unwear(object *);
584 void do_wear(object *);
585 void wield(void);
586 void do_wield(object *);
587 void unwield(object *);
588 void call_it(void);
589 short pack_count(const object *);
590 boolean has_amulet(void);
591 void kick_into_pack(void);
593 /* play.c */
594 void play_level(void);
596 /* random.c */
597 int get_rand(int, int);
598 boolean rand_percent(int);
599 boolean coin_toss(void);
601 /* ring.c */
602 void put_on_ring(void);
603 void do_put_on(object *, boolean);
604 void remove_ring(void);
605 void un_put_on(object *);
606 void gr_ring(object *, boolean);
607 void inv_rings(void);
608 void ring_stats(boolean);
610 /* room.c */
611 void light_up_room(int);
612 void light_passage(int, int);
613 void darken_room(short);
614 char get_dungeon_char(int, int);
615 char get_mask_char(unsigned short);
616 void gr_row_col(short *, short *, unsigned short);
617 short gr_room(void);
618 short party_objects(short);
619 short get_room_number(int, int);
620 boolean is_all_connected(void);
621 void draw_magic_map(void);
622 void dr_course(object *, boolean, short, short);
623 void edit_opts(void);
624 void do_shell(void);
626 /* save.c */
627 void save_game(void);
628 void save_into_file(const char *);
629 void restore(const char *);
631 /* score.c */
632 void killed_by(const object *, short) __dead2;
633 void win(void) __dead2;
634 void quit(boolean);
635 void put_scores(const object *, short) __dead2;
636 boolean is_vowel(short);
637 void xxxx(char *, short);
638 long xxx(boolean);
640 /* spec_hit.c */
641 void special_hit(object *);
642 void rust(object *);
643 void cough_up(object *);
644 boolean seek_gold(object *);
645 void check_gold_seeker(object *);
646 boolean check_imitator(object *);
647 boolean imitating(short, short);
648 boolean m_confuse(object *);
649 boolean flame_broil(object *);
651 /* throw.c */
652 void throw(void);
653 void rand_around(short, short *, short *);
655 /* trap.c */
656 void trap_player(short, short);
657 void add_traps(void);
658 void id_trap(void);
659 void show_traps(void);
660 void search(short, boolean);
662 /* use.c */
663 void quaff(void);
664 void read_scroll(void);
665 void vanish(object *, short, object *);
666 void eat(void);
667 void tele(void);
668 void hallucinate(void);
669 void unhallucinate(void);
670 void unblind(void);
671 void relight(void);
672 void take_a_nap(void);
673 void cnfs(void);
674 void unconfuse(void);
676 /* zap.c */
677 void zapp(void);
678 void wizardize(void);
679 void bounce(short, short, short, short, short);
682 * external variable declarations.
684 extern boolean ask_quit;
685 extern boolean being_held;
686 extern boolean cant_int;
687 extern boolean con_mon;
688 extern boolean detect_monster;
689 extern boolean did_int;
690 extern boolean flush;
691 extern boolean interrupted;
692 extern boolean is_wood[];
693 extern boolean jump;
694 extern boolean maintain_armor;
695 extern boolean mon_disappeared;
696 extern boolean msg_cleared;
697 extern boolean no_skull;
698 extern boolean passgo;
699 extern boolean r_see_invisible;
700 extern boolean r_teleport;
701 extern boolean save_is_interactive;
702 extern boolean score_only;
703 extern boolean see_invisible;
704 extern boolean sustain_strength;
705 extern boolean trap_door;
706 extern boolean wizard;
707 extern char hit_message[HIT_MESSAGE_SIZE];
708 extern char hunger_str[HUNGER_STR_LEN];
709 extern char login_name[MAX_OPT_LEN];
710 extern const char *byebye_string;
711 extern const char curse_message[];
712 extern const char *error_file;
713 extern char *fruit;
714 extern const char *const m_names[];
715 extern const char *more;
716 extern const char *new_level_message;
717 extern char *nick_name;
718 extern const char *press_space;
719 extern char *save_file;
720 extern const char you_can_move_again[];
721 extern const long level_points[];
722 extern short add_strength;
723 extern short auto_search;
724 extern short bear_trap;
725 extern short blind;
726 extern short confused;
727 extern short cur_level;
728 extern short cur_room;
729 extern short e_rings;
730 extern short extra_hp;
731 extern short foods;
732 extern short halluc;
733 extern short haste_self;
734 extern short less_hp;
735 extern short levitate;
736 extern short m_moves;
737 extern short max_level;
738 extern short party_room;
739 extern short r_rings;
740 extern short regeneration;
741 extern short ring_exp;
742 extern short stealthy;