X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/7d7fd1d69fceb79900e4d597c5e2bdbad06d6cc0..98a4fc6346f602b2e70306c8a0c79c4e984d1009:/rogue/rogue.h diff --git a/rogue/rogue.h b/rogue/rogue.h index 6375bda0..d1bd8b5e 100644 --- a/rogue/rogue.h +++ b/rogue/rogue.h @@ -1,4 +1,4 @@ -/* $NetBSD: rogue.h,v 1.8 1998/11/10 13:01:32 hubertf Exp $ */ +/* $NetBSD: rogue.h,v 1.21 2011/05/23 23:01:17 joerg Exp $ */ /* * Copyright (c) 1988, 1993 @@ -15,11 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -192,10 +188,11 @@ #define MAX_OPT_LEN 40 +#define MAX_ID_TITLE_LEN 64 struct id { short value; - char *title; - char *real; + char title[MAX_ID_TITLE_LEN]; + const char *real; unsigned short id_status; }; @@ -245,8 +242,8 @@ struct obj { /* comment is monster meaning */ typedef struct obj object; -#define INIT_AW (object*)0 -#define INIT_RINGS (object*)0 +#define INIT_AW NULL +#define INIT_RINGS NULL #define INIT_HP 12 #define INIT_STR 16 #define INIT_EXPLEVEL 1 @@ -296,9 +293,9 @@ typedef struct rm room; #define MAXROOMS 9 #define BIG_ROOM 10 -#define NO_ROOM -1 +#define NO_ROOM (-1) -#define PASSAGE -3 /* cur_room value */ +#define PASSAGE (-3) /* cur_room value */ #define AMULET_LEVEL 26 @@ -352,7 +349,6 @@ extern struct id id_rings[]; extern struct id id_weapons[]; extern struct id id_armors[]; -extern object mon_tab[]; extern object level_monsters; #define MONSTERS 26 @@ -436,328 +432,212 @@ struct rogue_time { short second; /* 0 - 59 */ }; -#ifdef CURSES -struct _win_st { - short _cury, _curx; - short _maxy, _maxx; -}; - -typedef struct _win_st WINDOW; - -extern int LINES, COLS; -extern WINDOW *curscr; -extern char *CL; - -#else #include -#endif /* * external routine declarations. */ #include #include - -object *alloc_object __P((void)); -object *check_duplicate __P((object *, object *)); -const char *get_ench_color __P((void)); -object *get_letter_object __P((int)); -object *get_thrown_at_monster __P((object *, short, short *, short *)); -object *get_zapped_monster __P((short, short *, short *)); -object *gr_monster __P((object *, int)); -object *gr_object __P((void)); -char *md_getenv __P((const char *)); +#include +#include + +object *alloc_object(void); +object *get_letter_object(int); +object *gr_monster(object *, int); +object *gr_object(void); +char *md_getenv(const char *); const char * - md_gln __P((void)); -char *md_malloc __P((int)); -const char *mon_name __P((const object *)); -const char *name_of __P((const object *)); -object *object_at __P((object *, short, short)); -object *pick_up __P((int, int, short *)); -void add_exp __P((int, boolean)); -void add_mazes __P((void)); -void add_traps __P((void)); -void aggravate __P((void)); -void aim_monster __P((object *)); -void bounce __P((short, short, short, short, short)); -void byebye __P((int)); -void c_object_for_wizard __P((void)); -void call_it __P((void)); -boolean can_move __P((int, int, int, int)); -boolean can_turn __P((int, int)); -void center __P((short, const char *)); -void check_gold_seeker __P((object *)); -boolean check_hunger __P((boolean)); -boolean check_imitator __P((object *)); -void check_message __P((void)); -int check_up __P((void)); -void clean_up __P((const char *)) __attribute__((__noreturn__)); -void clear_level __P((void)); -void cnfs __P((void)); -int coin_toss __P((void)); -int connect_rooms __P((short, short)); -void cough_up __P((object *)); -void create_monster __P((void)); -int damage_for_strength __P((void)); -void darken_room __P((short)); -void disappear __P((object *)); -void do_args __P((int, char **)); -void do_opts __P((void)); -void do_put_on __P((object *, boolean)); -void do_shell __P((void)); -void do_wear __P((object *)); -void do_wield __P((object *)); -void dr_course __P((object *, boolean, short, short)); -void drain_life __P((void)); -void draw_magic_map __P((void)); -void draw_simple_passage __P((short, short, short, short, short)); -void drop __P((void)); -int drop_check __P((void)); -void drop_level __P((void)); -void eat __P((void)); -void edit_opts __P((void)); -void env_get_value __P((char **, char *, boolean)); -void error_save __P((int)) __attribute__((__noreturn__)); -void fight __P((int)); -void fill_it __P((int, boolean)); -void fill_out_level __P((void)); -boolean flame_broil __P((object *)); -int flit __P((object *)); -void flop_weapon __P((object *, short, short)); -void free_object __P((object *)); -void free_stuff __P((object *)); -void freeze __P((object *)); -int get_armor_class __P((const object *)); -int get_com_id __P((int *, short)); -int get_damage __P((const char *, boolean)); -void get_desc __P((const object *, char *)); -int get_dir __P((short, short, short, short)); -void get_dir_rc __P((short, short *, short *, short)); -char get_dungeon_char __P((short, short)); -int get_exp_level __P((long)); -void get_food __P((object *, boolean)); -int get_hit_chance __P((const object *)); -int get_input_line __P((const char *, const char *, char *, const char *, boolean, boolean)); -char get_mask_char __P((unsigned short)); -int get_number __P((const char *)); -boolean get_oth_room __P((short, short *, short *)); -int get_rand __P((int, int)); -short get_room_number __P((int, int)); -int get_value __P((const object *)); -int get_w_damage __P((const object *)); -void get_wand_and_ring_materials __P((void)); -int get_weapon_damage __P((const object *)); -char gmc __P((object *)); -char gmc_row_col __P((int, int)); -void go_blind __P((void)); -boolean gold_at __P((int, int)); -void gr_armor __P((object *)); -char gr_dir __P((void)); -char gr_obj_char __P((void)); -void gr_potion __P((object *)); -void gr_ring __P((object *, boolean)); -short gr_room __P((void)); -void gr_row_col __P((short *, short *, unsigned short)); -void gr_scroll __P((object *)); -void gr_wand __P((object *)); -void gr_weapon __P((object *, int)); -void hallucinate __P((void)); -boolean has_amulet __P((void)); -boolean has_been_touched __P((const struct rogue_time *, const struct rogue_time *)); -void heal __P((void)); -void hide_boxed_passage __P((int, int, int, int, int)); -void hold_monster __P((void)); -int hp_raise __P((void)); -void id_all __P((void)); -void id_com __P((void)); -void id_trap __P((void)); -void id_type __P((void)); -void idntfy __P((void)); -boolean imitating __P((int, int)); -int init __P((int, char **)); -void init_str __P((char **, const char *)); -void insert_score __P((char [][], char [][], const char *, short, short, const object *, int)); -void inv_armor_weapon __P((boolean)); -void inv_rings __P((void)); -void inventory __P((const object *, unsigned short)); -boolean is_all_connected __P((void)); -boolean is_digit __P((int)); -boolean is_direction __P((short, short *)); -boolean is_pack_letter __P((short *, unsigned short *)); -boolean is_passable __P((int, int)); -boolean is_vowel __P((short)); -void kick_into_pack __P((void)); -void killed_by __P((const object *, short)); -long lget_number __P((const char *)); -void light_passage __P((int, int)); -void light_up_room __P((int)); -boolean m_confuse __P((object *)); -void make_level __P((void)); -void make_maze __P((short, short, short, short, short, short)); -void make_party __P((void)); -void make_room __P((short, short, short, short)); -void make_scroll_titles __P((void)); -boolean mask_pack __P((const object *, unsigned short)); -boolean mask_room __P((short, short *, short *, unsigned short)); -void md_cbreak_no_echo_nonl __P((boolean)); -boolean md_df __P((const char *)); -void md_exit __P((int)) __attribute__((__noreturn__)); -void md_gct __P((struct rogue_time *)); -char *md_gdtcf __P((void)); -int md_get_file_id __P((const char *)); -void md_gfmt __P((const char *, struct rogue_time *)); -int md_gseed __P((void)); -void md_heed_signals __P((void)); -void md_ignore_signals __P((void)); -int md_link_count __P((const char *)); -void md_lock __P((boolean)); -void md_shell __P((const char *)); -void md_sleep __P((int)); -void md_slurp __P((void)); -void md_tstp __P((void)); -void message __P((const char *, boolean)); -void mix_colors __P((void)); -void mix_colors __P((void)); -void mix_random_rooms __P((void)); -int mon_can_go __P((const object *, int, int)); -int mon_damage __P((object *, short)); -void mon_hit __P((object *)); -boolean mon_sees __P((const object *, int, int)); -int move_confused __P((object *)); -void move_mon_to __P((object *, int, int)); -void move_onto __P((void)); -int mtry __P((object *, int, int)); -void multiple_move_rogue __P((short)); -void mv_1_monster __P((object *, int, int)); -void mv_aquatars __P((void)); -void mv_mons __P((void)); -int name_cmp __P((char *, const char *)); -short next_avail_ichar __P((void)); -boolean next_to_something __P((int, int)); -void nickize __P((char *, const char *, const char *)); -int no_room_for_monster __P((int)); -int one_move_rogue __P((short, short)); -void onintr __P((int)); -void opt_erase __P((int)); -void opt_go __P((int)); -void opt_show __P((int)); -short pack_count __P((const object *)); -short pack_letter __P((const char *, unsigned short)); -void pad __P((const char *, short)); -void party_monsters __P((int, int)); -short party_objects __P((int)); -void place_at __P((object *, int, int)); -void plant_gold __P((int, int, boolean)); -void play_level __P((void)); -void player_init __P((void)); -void player_init __P((void)); -void potion_heal __P((int)); -int pr_com_id __P((int)); -int pr_motion_char __P((int)); -void print_stats __P((int)); -void put_amulet __P((void)); -void put_door __P((room *, short, short *, short *)); -void put_gold __P((void)); -void put_m_at __P((int, int, object *)); -void put_mons __P((void)); -void put_objects __P((void)); -void put_on_ring __P((void)); -void put_player __P((short)); -void put_scores __P((const object *, short)) __attribute__((__noreturn__)); -void put_stairs __P((void)); -void quaff __P((void)); -void quit __P((boolean)); -int r_index __P((const char *, int, boolean)); -void r_read __P((FILE *, char *, int)); -void r_write __P((FILE *, const char *, int)); -void rand_around __P((short, short *, short *)); -int rand_percent __P((int)); -void rand_place __P((object *)); -void read_pack __P((object *, FILE *, boolean)); -void read_scroll __P((void)); -void read_string __P((char *, FILE *)); -void recursive_deadend __P((short, const short *, short, short)); -boolean reg_move __P((void)); -void relight __P((void)); -void remessage __P((short)); -void remove_ring __P((void)); -void rest __P((int)); -void restore __P((const char *)); -int rgetchar __P((void)); -void ring_stats __P((boolean)); -int rogue_can_see __P((int, int)); -void rogue_damage __P((short, object *, short)); -void rogue_hit __P((object *, boolean)); -int rogue_is_around __P((int, int)); -long rrandom __P((void)); -void rust __P((object *)); -void rw_dungeon __P((FILE *, boolean)); -void rw_id __P((struct id *, FILE *, int, boolean)); -void rw_rooms __P((FILE *, boolean)); -void s_con_mon __P((object *)); -int same_col __P((int, int)); -int same_row __P((int, int)); -void save_game __P((void)); -void save_into_file __P((const char *)); -void save_screen __P((void)); -void search __P((short, boolean)); -boolean seek_gold __P((object *)); -void sell_pack __P((void)); -void sf_error __P((void)) __attribute__((__noreturn__)); -void show_average_hp __P((void)); -void show_monsters __P((void)); -void show_objects __P((void)); -void show_traps __P((void)); -void single_inv __P((short)); -void sound_bell __P((void)); -void special_hit __P((object *)); -void srrandom __P((int)); -void start_window __P((void)); -void start_window __P((void)); -void steal_gold __P((object *)); -void steal_item __P((object *)); -void sting __P((object *)); -void stop_window __P((void)); -void stop_window __P((void)); -void take_a_nap __P((void)); -void take_from_pack __P((object *, object *)); -void take_off __P((void)); -void tele __P((void)); -void tele_away __P((object *)); -void throw __P((void)); -boolean throw_at_monster __P((object *, object *)); -int to_hit __P((const object *)); -short trap_at __P((int, int)); -void trap_player __P((int, int)); -boolean try_to_cough __P((short, short, object *)); -void turn_passage __P((short, boolean)); -void un_put_on __P((object *)); -void unblind __P((void)); -void unconfuse __P((void)); -void uncurse_all __P((void)); -void unhallucinate __P((void)); -void unwear __P((object *)); -void unwield __P((object *)); -void vanish __P((object *, short, object *)); -void visit_rooms __P((int)); -void wait_for_ack __P((void)); -void wake_room __P((short, boolean, short, short)); -void wake_up __P((object *)); -void wanderer __P((void)); -void wdrain_life __P((object *)); -void wear __P((void)); -void wield __P((void)); -void win __P((void)); -void wizardize __P((void)); -void write_pack __P((const object *, FILE *)); -void write_string __P((char *, FILE *)); -long xxx __P((boolean)); -void xxxx __P((char *, short)); -void zap_monster __P((object *, unsigned short)); -void zapp __P((void)); -object *add_to_pack __P((object *, object *, int)); -struct id *get_id_table __P((const object *)); -unsigned short gr_what_is __P((void)); + md_gln(void); +void *md_malloc(size_t); +const char *mon_name(const object *); +const char *name_of(const object *); +object *object_at(object *, short, short); +object *pick_up(int, int, short *); +void add_exp(int, boolean); +void add_traps(void); +void aggravate(void); +void bounce(short, short, short, short, short); +void byebye(int); +void c_object_for_wizard(void); +void call_it(void); +boolean can_move(int, int, int, int); +void check_gold_seeker(object *); +boolean check_imitator(object *); +void check_message(void); +int check_up(void); +void clean_up(const char *) __attribute__((__noreturn__)); +void clear_level(void); +void cnfs(void); +int coin_toss(void); +void cough_up(object *); +void create_monster(void); +void darken_room(short); +void do_put_on(object *, boolean); +void do_shell(void); +void do_wear(object *); +void do_wield(object *); +void dr_course(object *, boolean, short, short); +void draw_magic_map(void); +void drop(void); +int drop_check(void); +void eat(void); +void edit_opts(void); +void error_save(int) __attribute__((__noreturn__)); +void fight(boolean); +boolean flame_broil(object *); +void free_object(object *); +void free_stuff(object *); +int get_armor_class(const object *); +int get_damage(const char *, boolean); +void get_desc(const object *, char *, size_t); +void get_dir_rc(short, short *, short *, short); +char get_dungeon_char(short, short); +void get_food(object *, boolean); +int get_hit_chance(const object *); +int get_input_line(const char *, const char *, char *, size_t, const char *, boolean, boolean); +char get_mask_char(unsigned short); +int get_number(const char *); +int get_rand(int, int); +short get_room_number(int, int); +void get_wand_and_ring_materials(void); +int get_weapon_damage(const object *); +char gmc(object *); +char gmc_row_col(int, int); +char gr_obj_char(void); +void gr_ring(object *, boolean); +short gr_room(void); +void gr_row_col(short *, short *, unsigned short); +void hallucinate(void); +boolean has_amulet(void); +int hp_raise(void); +void id_com(void); +void id_trap(void); +void id_type(void); +boolean imitating(short, short); +int init(int, char **); +void insert_score(char [][82], char [][30], const char *, short, short, const object *, int); +void inv_armor_weapon(boolean); +void inv_rings(void); +void inventory(const object *, unsigned short); +boolean is_all_connected(void); +boolean is_digit(int); +boolean is_direction(short, short *); +boolean is_passable(int, int); +boolean is_vowel(short); +void kick_into_pack(void); +void killed_by(const object *, short) __attribute__((__noreturn__)); +long lget_number(const char *); +void light_passage(int, int); +void light_up_room(int); +boolean m_confuse(object *); +void make_level(void); +void make_scroll_titles(void); +boolean md_df(const char *); +void md_exit(int) __attribute__((__noreturn__)); +void md_gct(struct rogue_time *); +int md_get_file_id(const char *); +void md_gfmt(const char *, struct rogue_time *); +int md_gseed(void); +void md_heed_signals(void); +void md_ignore_signals(void); +int md_link_count(const char *); +void md_lock(boolean); +void md_shell(const char *); +void md_sleep(int); +void md_slurp(void); +/*void message(const char *, boolean);*/ +void messagef(boolean, const char *, ...) + __attribute__((__format__(__printf__, 2, 3))); +void mix_colors(void); +int mon_can_go(const object *, short, short); +int mon_damage(object *, short); +void mon_hit(object *); +boolean mon_sees(const object *, int, int); +void move_mon_to(object *, short, short); +void move_onto(void); +void multiple_move_rogue(short); +void mv_1_monster(object *, short, short); +void mv_aquatars(void); +void mv_mons(void); +int name_cmp(char *, const char *); +void nickize(char *, const char *, const char *); +int one_move_rogue(short, short); +void onintr(int); +short pack_count(const object *); +short pack_letter(const char *, unsigned short); +void pad(const char *, short); +void party_monsters(int, int); +short party_objects(int); +void place_at(object *, int, int); +void play_level(void); +void print_stats(int); +void put_amulet(void); +void put_mons(void); +void put_objects(void); +void put_on_ring(void); +void put_player(short); +void put_scores(const object *, short) __attribute__((__noreturn__)); +void put_stairs(void); +void quaff(void); +void quit(boolean); +int r_index(const char *, int, boolean); +void rand_around(short, short *, short *); +int rand_percent(int); +void read_scroll(void); +boolean reg_move(void); +void relight(void); +void remessage(short); +void remove_ring(void); +void rest(int); +void restore(const char *); +int rgetchar(void); +void ring_stats(boolean); +int rogue_can_see(int, int); +void rogue_damage(short, object *, short); +void rogue_hit(object *, boolean); +void rust(object *); +void s_con_mon(object *); +void save_game(void); +void save_into_file(const char *); +void search(short, boolean); +boolean seek_gold(object *); +void show_average_hp(void); +void show_monsters(void); +void show_objects(void); +void show_traps(void); +void single_inv(short); +void sound_bell(void); +void special_hit(object *); +void srrandom(int); +void start_window(void); +void stop_window(void); +void take_a_nap(void); +void take_from_pack(object *, object *); +void take_off(void); +void tele(void); +void throw(void); +void trap_player(short, short); +void un_put_on(object *); +void unblind(void); +void unconfuse(void); +void unhallucinate(void); +void unwear(object *); +void unwield(object *); +void vanish(object *, short, object *); +void wait_for_ack(void); +void wake_room(short, boolean, short, short); +void wake_up(object *); +void wanderer(void); +void wear(void); +void wield(void); +void win(void) __attribute__((__noreturn__)); +void wizardize(void); +long xxx(boolean); +void xxxx(char *, short); +void zapp(void); +object *add_to_pack(object *, object *, int); +struct id *get_id_table(const object *); extern boolean ask_quit; extern boolean being_held; @@ -781,11 +661,13 @@ extern boolean see_invisible; extern boolean sustain_strength; extern boolean trap_door; extern boolean wizard; -extern char hit_message[]; -extern char hunger_str[]; -extern char login_name[]; +#define HIT_MESSAGE_SIZE 80 +extern char hit_message[HIT_MESSAGE_SIZE]; +#define HUNGER_STR_LEN 8 +extern char hunger_str[HUNGER_STR_LEN]; +extern char login_name[MAX_OPT_LEN]; extern const char *byebye_string; -extern const char *curse_message; +extern const char curse_message[]; extern const char *error_file; extern char *fruit; extern const char *const m_names[]; @@ -794,7 +676,7 @@ extern const char *new_level_message; extern char *nick_name; extern const char *press_space; extern char *save_file; -extern const char *you_can_move_again; +extern const char you_can_move_again[]; extern const long level_points[]; extern short add_strength; extern short auto_search; @@ -817,3 +699,5 @@ extern short r_rings; extern short regeneration; extern short ring_exp; extern short stealthy; +extern gid_t gid; +extern gid_t egid;