OSDN Git Service

1e67f682cb5cf13f7e79f8f99f6747c989a167a2
[hengband/hengband.git] / src / variable.c
1 /* File: variable.c */
2
3 /* Purpose: Angband variables */
4
5 /*
6  * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
7  *
8  * This software may be copied and distributed for educational, research, and
9  * not for profit purposes provided that this copyright and statement are
10  * included in all such copies.
11  */
12
13 #include "angband.h"
14
15
16 /*
17  * Hack -- Link a copyright message into the executable
18  */
19 cptr copyright[5] =
20 {
21         "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
22         "",
23         "This software may be copied and distributed for educational, research,",
24         "and not for profit purposes provided that this copyright and statement",
25         "are included in all such copies."
26 };
27
28
29 /* ¥ì¥Ù¥ë¥¢¥Ã¥×¤Î»þ¤Ë¾å¾ºÎ̤òɽ¼¨¤¹¤ë¤Î¤Ë»È¤¦ */
30 int level_up = 0;
31 int max_autopick=0;
32 unsigned char *autopick_name[MAX_AUTOPICK];
33 unsigned char *autopick_insc[MAX_AUTOPICK];
34 s16b autopick_action[MAX_AUTOPICK];
35
36 /*
37  * Executable version
38  */
39 byte version_major = VERSION_MAJOR;
40 byte version_minor = VERSION_MINOR;
41 byte version_patch = VERSION_PATCH;
42 byte version_extra = VERSION_EXTRA;
43
44 /*
45  * Savefile version
46  */
47 byte sf_major;                  /* Savefile's "version_major" */
48 byte sf_minor;                  /* Savefile's "version_minor" */
49 byte sf_patch;                  /* Savefile's "version_patch" */
50 byte sf_extra;                  /* Savefile's "version_extra" */
51 u32b sf_version;                /* Savefile's "version" */
52
53 byte z_major;           /* Savefile version for Hengband */
54 byte z_minor;
55 byte z_patch;
56
57 /*
58  * Savefile information
59  */
60 u32b sf_xtra;                   /* Operating system info */
61 u32b sf_when;                   /* Time when savefile created */
62 u16b sf_lives;                  /* Number of past "lives" with this file */
63 u16b sf_saves;                  /* Number of "saves" during this life */
64
65 /*
66  * Run-time arguments
67  */
68 bool arg_fiddle;                        /* Command arg -- Request fiddle mode */
69 bool arg_wizard;                        /* Command arg -- Request wizard mode */
70 bool arg_sound;                         /* Command arg -- Request special sounds */
71 byte arg_graphics;                      /* Command arg -- Request graphics mode */
72 bool arg_monochrome;            /* Command arg -- Request monochrome mode */
73 bool arg_force_original;        /* Command arg -- Request original keyset */
74 bool arg_force_roguelike;       /* Command arg -- Request roguelike keyset */
75
76 /*
77  * Various things
78  */
79 bool character_generated;       /* The character exists */
80 bool character_dungeon;         /* The character has a dungeon */
81 bool character_loaded;          /* The character was loaded from a savefile */
82 bool character_saved;           /* The character was just saved to a savefile */
83
84 bool character_icky;            /* The game is in an icky full screen mode */
85 bool character_xtra;            /* The game is in an icky startup mode */
86
87 u32b seed_flavor;               /* Hack -- consistent object colors */
88 u32b seed_town;                 /* Hack -- consistent town layout */
89
90 s16b command_cmd;               /* Current "Angband Command" */
91
92 s16b command_arg;               /* Gives argument of current command */
93 s16b command_rep;               /* Gives repetition of current command */
94 s16b command_dir;               /* Gives direction of current command */
95
96 s16b command_see;               /* See "cmd1.c" */
97 s16b command_wrk;               /* See "cmd1.c" */
98
99 s16b command_gap = 50;  /* See "cmd1.c" */
100
101 s16b command_new;               /* Command chaining from inven/equip view */
102
103 s16b energy_use;                /* Energy use this turn */
104
105 byte create_up_stair;   /* Auto-create "up stairs" */
106 byte create_down_stair; /* Auto-create "down stairs" */
107
108 bool msg_flag;                  /* Used in msg_print() for "buffering" */
109
110 bool alive;                             /* True if game is running */
111
112 bool death;                             /* True if player has died */
113
114 s16b running;                   /* Current counter for running, if any */
115 s16b resting;                   /* Current counter for resting, if any */
116
117 s16b cur_hgt;                   /* Current dungeon height */
118 s16b cur_wid;                   /* Current dungeon width */
119 s16b dun_level;                 /* Current dungeon level */
120 s16b num_repro;                 /* Current reproducer count */
121 s16b object_level;              /* Current object creation level */
122 s16b monster_level;             /* Current monster creation level */
123 s16b base_level;        /* Base dungeon level */
124
125 s32b turn;                              /* Current game turn */
126 s32b dungeon_turn;                      /* Game turn in dungeon */
127 s32b old_turn;                  /* Turn when level began (feelings) */
128 s32b old_battle;
129
130 bool wizard;                    /* Is the player currently in Wizard mode? */
131
132 bool use_sound;                 /* The "sound" mode is enabled */
133 bool use_graphics;              /* The "graphics" mode is enabled */
134
135 u16b total_winner;              /* Semi-Hack -- Game has been won */
136
137 u16b panic_save;                /* Track some special "conditions" */
138 u16b noscore;                   /* Track various "cheating" conditions */
139 bool wait_report_score;         /* Waiting to report score */
140
141 s16b signal_count;              /* Hack -- Count interupts */
142
143 bool inkey_base;                /* See the "inkey()" function */
144 bool inkey_xtra;                /* See the "inkey()" function */
145 bool inkey_scan;                /* See the "inkey()" function */
146 bool inkey_flag;                /* See the "inkey()" function */
147
148 s16b coin_type;                 /* Hack -- force coin type */
149
150 bool opening_chest;             /* Hack -- prevent chest generation */
151
152 bool shimmer_monsters;  /* Hack -- optimize multi-hued monsters */
153 bool shimmer_objects;   /* Hack -- optimize multi-hued objects */
154
155 bool repair_monsters;   /* Hack -- optimize detect monsters */
156 bool repair_objects;    /* Hack -- optimize detect objects */
157
158 s16b inven_nxt;                 /* Hack -- unused */
159 bool hack_mind;
160 bool hack_mutation;
161 int artifact_bias;
162
163 s16b inven_cnt;                 /* Number of items in inventory */
164 s16b equip_cnt;                 /* Number of items in equipment */
165
166 s16b o_max = 1;                 /* Number of allocated objects */
167 s16b o_cnt = 0;                 /* Number of live objects */
168
169 s16b m_max = 1;                 /* Number of allocated monsters */
170 s16b m_cnt = 0;                 /* Number of live monsters */
171
172 s16b hack_m_idx = 0;    /* Hack -- see "process_monsters()" */
173 s16b hack_m_idx_ii = 0;
174 bool multi_rew = FALSE;
175 char summon_kin_type;   /* Hack, by Julian Lighton: summon 'relatives' */
176
177 int total_friends = 0;
178 s32b total_friend_levels = 0;
179 s32b friend_align = 0;
180
181 int leaving_quest = 0;
182
183
184 /*
185  * Software options (set via the '=' command).  See "tables.c"
186  */
187
188
189 /* Option Set 1 -- User Interface */
190
191 bool rogue_like_commands;       /* Rogue-like commands */
192 bool quick_messages;            /* Activate quick messages */
193 bool auto_more;
194 bool command_menu;
195 bool other_query_flag;          /* Prompt for various information */
196 bool carry_query_flag;          /* Prompt before picking things up */
197 bool use_old_target;            /* Use old target by default */
198 bool always_pickup;                     /* Pick things up by default */
199 bool always_repeat;                     /* Repeat obvious commands */
200 bool depth_in_feet;                     /* Show dungeon level in feet */
201
202 bool stack_force_notes;         /* Merge inscriptions when stacking */
203 bool stack_force_costs;         /* Merge discounts when stacking */
204
205 bool show_labels;                       /* Show labels in object listings */
206 bool show_weights;                      /* Show weights in object listings */
207 bool show_choices;                      /* Show choices in certain sub-windows */
208
209 bool ring_bell;                         /* Ring the bell (on errors, etc) */
210
211 bool show_item_graph;
212
213
214 /* Option Set 2 -- Disturbance */
215
216 bool find_ignore_stairs;        /* Run past stairs */
217 bool find_ignore_doors;         /* Run through open doors */
218 bool find_cut;                          /* Run past known corners */
219 bool find_examine;                      /* Run into potential corners */
220
221 bool disturb_move;                      /* Disturb whenever any monster moves */
222 bool disturb_near;                      /* Disturb whenever viewable monster moves */
223 bool disturb_panel;                     /* Disturb whenever map panel changes */
224 bool disturb_state;                     /* Disturn whenever player state changes */
225 bool disturb_minor;                     /* Disturb whenever boring things happen */
226
227 bool alert_hitpoint;            /* Alert user to critical hitpoints */
228 bool last_words;                /* Get last words upon dying */
229 bool over_exert;
230 bool small_levels;              /* Allow unusually small dungeon levels */
231 bool always_small_levels;               /* Use always unusually small dungeon levels */
232 bool empty_levels;              /* Allow empty 'arena' levels */
233 bool player_symbols;            /* Use varying symbols for the player char */
234 bool equippy_chars;             /* Back by popular demand... */
235 bool skip_mutations;            /* Skip mutations screen even if we have it */
236 bool plain_descriptions;        /* Plain object descriptions */
237 bool stupid_monsters;           /* Monsters use old AI */
238 bool confirm_destroy;           /* Known worthless items are destroyed without confirmation */
239 bool confirm_stairs;            /* Prompt before staircases... */
240 bool wear_confirm;              /* Confirm before putting on known cursed items */
241 bool disturb_pets;              /* Pets moving nearby disturb us */
242
243
244
245 /* Option Set 3 -- Game-Play */
246
247 bool manual_haggle;                     /* Auto-haggle in stores */
248
249 bool auto_scum;                         /* Auto-scum for good levels */
250
251 bool stack_allow_items;         /* Allow weapons and armor to stack */
252 bool stack_allow_wands;         /* Allow wands/staffs/rods to stack */
253
254 bool expand_look;                       /* Expand the power of the look command */
255 bool expand_list;                       /* Expand the power of the list commands */
256
257 bool view_perma_grids;          /* Map remembers all perma-lit grids */
258 bool view_torch_grids;          /* Map remembers all torch-lit grids */
259
260 bool dungeon_align;                     /* Generate dungeons with aligned rooms */
261 bool dungeon_stair;                     /* Generate dungeons with connected stairs */
262
263 bool track_follow;                      /* Monsters follow the player */
264 bool track_target;                      /* Monsters target the player */
265
266 bool smart_learn;                       /* Monsters learn from their mistakes */
267 bool smart_cheat;                       /* Monsters exploit player weaknesses */
268
269
270 /* Option Set 4 -- Efficiency */
271
272 bool view_reduce_lite;          /* Reduce lite-radius when running */
273 bool view_reduce_view;          /* Reduce view-radius in town */
274
275 bool avoid_abort;                       /* Avoid checking for user abort */
276
277 bool flush_failure;                     /* Flush input on any failure */
278 bool flush_disturb;                     /* Flush input on disturbance */
279
280 bool fresh_before;                      /* Flush output before normal commands */
281 bool fresh_after;                       /* Flush output after normal commands */
282 bool fresh_message;                     /* Flush output after all messages */
283
284 bool compress_savefile;         /* Compress messages in savefiles */
285
286 bool hilite_player;                     /* Hilite the player with the cursor */
287
288 bool view_yellow_lite;          /* Use special colors for torch-lit grids */
289 bool view_bright_lite;          /* Use special colors for 'viewable' grids */
290
291 bool view_granite_lite;         /* Use special colors for wall grids (slow) */
292 bool view_special_lite;         /* Use special colors for floor grids (slow) */
293 bool new_ascii_graphics;
294 bool display_path;
295 bool target_pet;
296 bool plain_pickup;
297
298 bool always_show_list;
299 bool powerup_home;
300 bool old_way_of_kaz;
301 bool send_score;
302
303 /* Cheating options */
304
305 bool cheat_peek;                /* Peek into object creation */
306 bool cheat_hear;                /* Peek into monster creation */
307 bool cheat_room;                /* Peek into dungeon creation */
308 bool cheat_xtra;                /* Peek into something else */
309 bool cheat_know;                /* Know complete monster info */
310 bool cheat_live;                /* Allow player to avoid death */
311
312
313 /* Special options */
314
315 byte hitpoint_warn;             /* Hitpoint warning (0 to 9) */
316
317 byte delay_factor;              /* Delay factor (0 to 9) */
318
319 bool autosave_l;        /* Autosave before entering new levels */
320 bool autosave_t;        /* Timed autosave */
321 s16b autosave_freq;     /* Autosave frequency */
322
323
324 /*
325  * Dungeon variables
326  */
327
328 byte feeling;                   /* Most recent feeling */
329 s16b rating;                    /* Level's current rating */
330
331 bool good_item_flag;            /* True if "Artifact" on this level */
332
333 bool closing_flag;              /* Dungeon is closing */
334
335
336 /*
337  * Dungeon size info
338  */
339
340 s16b max_panel_rows, max_panel_cols;
341 s16b panel_row, panel_col;
342 s16b panel_row_min, panel_row_max;
343 s16b panel_col_min, panel_col_max;
344 s16b panel_col_prt, panel_row_prt;
345
346 /*
347  * Player location in dungeon
348  */
349 s16b py;
350 s16b px;
351
352 /*
353  * Targetting variables
354  */
355 s16b target_who;
356 s16b target_col;
357 s16b target_row;
358
359
360 /*
361  * User info
362  */
363 int player_uid;
364 int player_euid;
365 int player_egid;
366
367 /*
368  * Current player's character name
369  */
370 char player_name[32];
371
372 /*
373  * Stripped version of "player_name"
374  */
375 char player_base[32];
376
377 /*
378  * What killed the player
379  */
380 char died_from[80];
381
382 /*
383  * Hack -- Textual "history" for the Player
384  */
385 char history[4][60];
386
387 /*
388  * Buffer to hold the current savefile name
389  * 'savefile' holds full path name. 'savefile_base' holds only base name.
390  */
391 char savefile[1024];
392 char savefile_base[40];
393
394 /*
395  * Array of grids lit by player lite (see "cave.c")
396  */
397 s16b lite_n;
398 s16b lite_y[LITE_MAX];
399 s16b lite_x[LITE_MAX];
400
401 /*
402  * Array of grids lit by player lite (see "cave.c")
403  */
404 s16b mon_lite_n;
405 s16b mon_lite_y[LITE_MAX];
406 s16b mon_lite_x[LITE_MAX];
407
408 /*
409  * Array of grids viewable to the player (see "cave.c")
410  */
411 s16b view_n;
412 byte view_y[VIEW_MAX];
413 byte view_x[VIEW_MAX];
414
415 /*
416  * Array of grids for use by various functions (see "cave.c")
417  */
418 s16b temp_n;
419 byte temp_y[TEMP_MAX];
420 byte temp_x[TEMP_MAX];
421
422
423 /*
424  * Number of active macros.
425  */
426 s16b macro__num;
427
428 /*
429  * Array of macro patterns [MACRO_MAX]
430  */
431 cptr *macro__pat;
432
433 /*
434  * Array of macro actions [MACRO_MAX]
435  */
436 cptr *macro__act;
437
438 /*
439  * Array of macro types [MACRO_MAX]
440  */
441 bool *macro__cmd;
442
443 /*
444  * Current macro action [1024]
445  */
446 char *macro__buf;
447
448
449 /*
450  * The number of quarks
451  */
452 s16b quark__num;
453
454 /*
455  * The pointers to the quarks [QUARK_MAX]
456  */
457 cptr *quark__str;
458
459
460 /*
461  * The next "free" index to use
462  */
463 u16b message__next;
464
465 /*
466  * The index of the oldest message (none yet)
467  */
468 u16b message__last;
469
470 /*
471  * The next "free" offset
472  */
473 u16b message__head;
474
475 /*
476  * The offset to the oldest used char (none yet)
477  */
478 u16b message__tail;
479
480 /*
481  * The array of offsets, by index [MESSAGE_MAX]
482  */
483 u16b *message__ptr;
484
485 /*
486  * The array of chars, by offset [MESSAGE_BUF]
487  */
488 char *message__buf;
489
490
491 /*
492  * The array of normal options
493  */
494 u32b option_flag[8];
495 u32b option_mask[8];
496
497
498 /*
499  * The array of window options
500  */
501 u32b window_flag[8];
502 u32b window_mask[8];
503
504
505 /*
506  * The array of window pointers
507  */
508 term *angband_term[8];
509
510
511 /*
512  * Standard window names
513  */
514 char angband_term_name[8][16] =
515 {
516         "Hengband",
517         "Term-1",
518         "Term-2",
519         "Term-3",
520         "Term-4",
521         "Term-5",
522         "Term-6",
523         "Term-7"
524 };
525
526
527 /*
528  * Global table of color definitions
529  */
530 byte angband_color_table[256][4] =
531 {
532         {0x00, 0x00, 0x00, 0x00},       /* TERM_DARK */
533         {0x00, 0xFF, 0xFF, 0xFF},       /* TERM_WHITE */
534         {0x00, 0x80, 0x80, 0x80},       /* TERM_SLATE */
535         {0x00, 0xFF, 0x80, 0x00},       /* TERM_ORANGE */
536         {0x00, 0xC0, 0x00, 0x00},       /* TERM_RED */
537         {0x00, 0x00, 0x80, 0x40},       /* TERM_GREEN */
538         {0x00, 0x00, 0x00, 0xFF},       /* TERM_BLUE */
539         {0x00, 0x80, 0x40, 0x00},       /* TERM_UMBER */
540         {0x00, 0x40, 0x40, 0x40},       /* TERM_L_DARK */
541         {0x00, 0xC0, 0xC0, 0xC0},       /* TERM_L_WHITE */
542         {0x00, 0xFF, 0x00, 0xFF},       /* TERM_VIOLET */
543         {0x00, 0xFF, 0xFF, 0x00},       /* TERM_YELLOW */
544         {0x00, 0xFF, 0x00, 0x00},       /* TERM_L_RED */
545         {0x00, 0x00, 0xFF, 0x00},       /* TERM_L_GREEN */
546         {0x00, 0x00, 0xFF, 0xFF},       /* TERM_L_BLUE */
547         {0x00, 0xC0, 0x80, 0x40}        /* TERM_L_UMBER */
548 };
549
550
551 /*
552  * Standard sound names
553  */
554 char angband_sound_name[SOUND_MAX][16] =
555 {
556         "",
557         "hit",
558         "miss",
559         "flee",
560         "drop",
561         "kill",
562         "level",
563         "death",
564         "study",
565         "teleport",
566         "shoot",
567         "quaff",
568         "zap",
569         "walk",
570         "tpother",
571         "hitwall",
572         "eat",
573         "store1",
574         "store2",
575         "store3",
576         "store4",
577         "dig",
578         "opendoor",
579         "shutdoor",
580         "tplevel",
581         "scroll",
582         "buy",
583         "sell",
584         "warn",
585         "rocket",
586         "n_kill",
587         "u_kill",
588         "quest",
589         "heal",
590         "x_heal",
591         "bite",
592         "claw",
593         "m_spell",
594         "summon",
595         "breath",
596         "ball",
597         "m_heal",
598         "atkspell",
599         "evil",
600         "touch",
601         "sting",
602         "crush",
603         "slime",
604         "wail",
605         "winner",
606         "fire",
607         "acid",
608         "elec",
609         "cold",
610         "illegal",
611         "fail",
612         "wakeup",
613         "invuln",
614         "fall",
615         "pain",
616         "destitem",
617         "moan",
618         "show",
619         "unused",
620         "explode",
621 };
622
623
624 /*
625  * The array of "cave grids" [MAX_WID][MAX_HGT].
626  * Not completely allocated, that would be inefficient
627  * Not completely hardcoded, that would overflow memory
628  */
629 cave_type *cave[MAX_HGT];
630
631 /*
632  * The array of dungeon items [max_o_idx]
633  */
634 object_type *o_list;
635
636 /*
637  * The array of dungeon monsters [max_m_idx]
638  */
639 monster_type *m_list;
640
641
642 /*
643  * Maximum number of towns
644  */
645 u16b max_towns;
646
647 /*
648  * The towns [max_towns]
649  */
650 town_type *town;
651
652
653 /*
654  * The player's inventory [INVEN_TOTAL]
655  */
656 object_type *inventory;
657
658
659 /*
660  * The size of "alloc_kind_table" (at most max_k_idx * 4)
661  */
662 s16b alloc_kind_size;
663
664 /*
665  * The entries in the "kind allocator table"
666  */
667 alloc_entry *alloc_kind_table;
668
669
670 /*
671  * The size of "alloc_race_table" (at most max_r_idx)
672  */
673 s16b alloc_race_size;
674
675 /*
676  * The entries in the "race allocator table"
677  */
678 alloc_entry *alloc_race_table;
679
680
681 /*
682  * Specify attr/char pairs for visual special effects
683  * Be sure to use "index & 0x7F" to avoid illegal access
684  */
685 byte misc_to_attr[256];
686 char misc_to_char[256];
687
688
689 /*
690  * Specify attr/char pairs for inventory items (by tval)
691  * Be sure to use "index & 0x7F" to avoid illegal access
692  */
693 byte tval_to_attr[128];
694 char tval_to_char[128];
695
696
697 /*
698  * Keymaps for each "mode" associated with each keypress.
699  */
700 cptr keymap_act[KEYMAP_MODES][256];
701
702
703
704 /*** Player information ***/
705
706 /*
707  * Static player info record
708  */
709 player_type p_body;
710
711 /*
712  * Pointer to the player info
713  */
714 player_type *p_ptr = &p_body;
715
716 /*
717  * Pointer to the player tables
718  * (sex, race, class, magic)
719  */
720 player_sex *sp_ptr;
721 player_race *rp_ptr;
722 player_class *cp_ptr;
723 player_seikaku *ap_ptr;
724 player_magic *mp_ptr;
725
726
727 /*
728  * More spell info
729  */
730 u32b spell_learned1;    /* bit mask of spells learned */
731 u32b spell_learned2;    /* bit mask of spells learned */
732 u32b spell_worked1;     /* bit mask of spells tried and worked */
733 u32b spell_worked2;     /* bit mask of spells tried and worked */
734 u32b spell_forgotten1;  /* bit mask of spells learned but forgotten */
735 u32b spell_forgotten2;  /* bit mask of spells learned but forgotten */
736 byte spell_order[64];   /* order spells learned/remembered/forgotten */
737
738
739 /*
740  * Calculated base hp values for player at each level,
741  * store them so that drain life + restore life does not
742  * affect hit points.  Also prevents shameless use of backup
743  * savefiles for hitpoint acquirement.
744  */
745 s16b player_hp[PY_MAX_LEVEL];
746
747
748 /*
749  * The vault generation arrays
750  */
751 header *v_head;
752 vault_type *v_info;
753 char *v_name;
754 char *v_text;
755
756 /*
757  * The terrain feature arrays
758  */
759 header *f_head;
760 feature_type *f_info;
761 char *f_name;
762 #ifdef JP
763 char *E_f_name;         /* ±Ñ¸ìÃÏ·Á̾ */
764 #endif
765 char *f_text;
766
767 /*
768  * The object kind arrays
769  */
770 header *k_head;
771 object_kind *k_info;
772 char *k_name;
773 #ifdef JP
774 char *E_k_name;         /* ±Ñ¸ì¥¢¥¤¥Æ¥à̾ */
775 #endif
776 char *k_text;
777
778 /*
779  * The artifact arrays
780  */
781 header *a_head;
782 artifact_type *a_info;
783 char *a_name;
784 #ifdef JP
785 char *E_a_name;         /* ±Ñ¸ì¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È̾ */
786 #endif
787 char *a_text;
788
789 /*
790  * The ego-item arrays
791  */
792 header *e_head;
793 ego_item_type *e_info;
794 char *e_name;
795 #ifdef JP
796 char *E_e_name;         /* ±Ñ¸ì¡Ö̾¤Î¤¢¤ë¡×¥¢¥¤¥Æ¥à̾ */
797 #endif
798 char *e_text;
799
800
801 /*
802  * The monster race arrays
803  */
804 header *r_head;
805 monster_race *r_info;
806 char *r_name;
807 #ifdef JP
808 char *E_r_name;         /* ±Ñ¸ì¥â¥ó¥¹¥¿¡¼Ì¾ */
809 #endif
810 char *r_text;
811
812
813 /*
814  * The dungeon arrays
815  */
816 header *d_head;
817 dungeon_info_type *d_info;
818 char *d_name;
819 char *d_text;
820
821
822 /*
823  * Hack -- The special Angband "System Suffix"
824  * This variable is used to choose an appropriate "pref-xxx" file
825  */
826 cptr ANGBAND_SYS = "xxx";
827
828 /*
829  * Hack -- The special Angband "Graphics Suffix"
830  * This variable is used to choose an appropriate "graf-xxx" file
831  */
832 cptr ANGBAND_GRAF = "old";
833
834 /*
835  * Path name: The main "lib" directory
836  * This variable is not actually used anywhere in the code
837  */
838 cptr ANGBAND_DIR;
839
840 /*
841  * High score files (binary)
842  * These files may be portable between platforms
843  */
844 cptr ANGBAND_DIR_APEX;
845
846 /*
847  * Bone files for player ghosts (ascii)
848  * These files are portable between platforms
849  */
850 cptr ANGBAND_DIR_BONE;
851
852 /*
853  * Binary image files for the "*_info" arrays (binary)
854  * These files are not portable between platforms
855  */
856 cptr ANGBAND_DIR_DATA;
857
858 /*
859  * Textual template files for the "*_info" arrays (ascii)
860  * These files are portable between platforms
861  */
862 cptr ANGBAND_DIR_EDIT;
863
864 /*
865  * Script files
866  * These files are portable between platforms.
867  */
868 cptr ANGBAND_DIR_SCRIPT;
869
870 /*
871  * Various extra files (ascii)
872  * These files may be portable between platforms
873  */
874 cptr ANGBAND_DIR_FILE;
875
876 /*
877  * Help files (normal) for the online help (ascii)
878  * These files are portable between platforms
879  */
880 cptr ANGBAND_DIR_HELP;
881
882 /*
883  * Help files (spoilers) for the online help (ascii)
884  * These files are portable between platforms
885  */
886 cptr ANGBAND_DIR_INFO;
887
888 /*
889  * Default user "preference" files (ascii)
890  * These files are rarely portable between platforms
891  */
892 cptr ANGBAND_DIR_PREF;
893
894 /*
895  * Savefiles for current characters (binary)
896  * These files are portable between platforms
897  */
898 cptr ANGBAND_DIR_SAVE;
899
900 /*
901  * User "preference" files (ascii)
902  * These files are rarely portable between platforms
903  */
904 cptr ANGBAND_DIR_USER;
905
906 /*
907  * Various extra files (binary)
908  * These files are rarely portable between platforms
909  */
910 cptr ANGBAND_DIR_XTRA;
911
912
913 /*
914  * Total Hack -- allow all items to be listed (even empty ones)
915  * This is only used by "do_cmd_inven_e()" and is cleared there.
916  */
917 bool item_tester_full;
918
919 bool item_tester_no_ryoute = FALSE;
920
921 /*
922  * Here is a "pseudo-hook" used during calls to "get_item()" and
923  * "show_inven()" and "show_equip()", and the choice window routines.
924  */
925 byte item_tester_tval;
926
927
928 /*
929  * Here is a "hook" used during calls to "get_item()" and
930  * "show_inven()" and "show_equip()", and the choice window routines.
931  */
932 bool (*item_tester_hook)(object_type*);
933
934
935
936 /*
937  * Current "comp" function for ang_sort()
938  */
939 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
940
941
942 /*
943  * Current "swap" function for ang_sort()
944  */
945 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
946
947
948
949 /*
950  * Hack -- function hooks to restrict "get_mon_num_prep()" function
951  */
952 monster_hook_type get_mon_num_hook;
953 monster_hook_type get_mon_num2_hook;
954
955
956 /*
957  * Hack -- function hook to restrict "get_obj_num_prep()" function
958  */
959 bool (*get_obj_num_hook)(int k_idx);
960
961
962 /* Hack, monk armour */
963 bool monk_armour_aux;
964 bool monk_notify_aux;
965
966 #ifdef ALLOW_EASY_OPEN /* TNB */
967 bool easy_open;
968 #endif /* ALLOW_EASY_OPEN -- TNB */
969
970 #ifdef ALLOW_EASY_DISARM /* TNB */
971 bool easy_disarm;
972 #endif /* ALLOW_EASY_DISARM -- TNB */
973
974 #ifdef ALLOW_EASY_FLOOR /* TNB */
975 bool easy_floor;
976 #endif /* ALLOW_EASY_FLOOR -- TNB */
977
978 bool use_command;
979 bool center_player;
980 bool center_running;
981
982 bool display_pick;
983 bool display_nopick;
984 bool display_destroy;
985
986 /* Auto-destruction options */
987 bool destroy_items;
988 bool leave_worth;
989 bool leave_equip;
990 bool leave_wanted;
991 bool leave_corpse;
992 bool leave_junk;
993 bool leave_chest;
994
995 /* Nikki */
996 bool record_fix_art;
997 bool record_rand_art;
998 bool record_destroy_uniq;
999 bool record_fix_quest;
1000 bool record_rand_quest;
1001 bool record_maxdeapth;
1002 bool record_stair;
1003 bool record_buy;
1004 bool record_sell;
1005 bool record_danger;
1006 bool record_arena;
1007 bool record_ident;
1008 bool record_named_pet;
1009 char record_o_name[MAX_NLEN];
1010 s32b record_turn;
1011
1012 /*
1013  * Wilderness
1014  */
1015 wilderness_type **wilderness;
1016
1017
1018 /*
1019  * Buildings
1020  */
1021 building_type building[MAX_BLDG];
1022
1023
1024 /*
1025  * Maximum number of quests
1026  */
1027 u16b max_quests;
1028
1029 /*
1030  * Maximum number of monsters in r_info.txt
1031  */
1032 u16b max_r_idx;
1033
1034 /*
1035  * Maximum number of items in k_info.txt
1036  */
1037 u16b max_k_idx;
1038
1039 /*
1040  * Maximum number of vaults in v_info.txt
1041  */
1042 u16b max_v_idx;
1043
1044 /*
1045  * Maximum number of terrain features in f_info.txt
1046  */
1047 u16b max_f_idx;
1048
1049 /*
1050  * Maximum number of artifacts in a_info.txt
1051  */
1052 u16b max_a_idx;
1053
1054 /*
1055  * Maximum number of ego-items in e_info.txt
1056  */
1057 u16b max_e_idx;
1058
1059 /*
1060  * Maximum number of dungeon in e_info.txt
1061  */
1062 u16b max_d_idx;
1063
1064 /*
1065  * Maximum number of objects in the level
1066  */
1067 u16b max_o_idx;
1068
1069 /*
1070  * Maximum number of monsters in the level
1071  */
1072 u16b max_m_idx;
1073
1074 /*
1075  * Maximum size of the wilderness
1076  */
1077 s32b max_wild_x;
1078 s32b max_wild_y;
1079
1080 /*
1081  * Quest info
1082  */
1083 quest_type *quest;
1084
1085 /*
1086  * Quest text
1087  */
1088 char quest_text[10][80];
1089
1090 /*
1091  * Current line of the quest text
1092  */
1093 int quest_text_line;
1094
1095 /*
1096  * Default spell color table (quark index)
1097  */
1098 s16b gf_color[MAX_GF];
1099
1100 /*
1101  * Flags for initialization
1102  */
1103 int init_flags;
1104
1105
1106 /*
1107  * The "highscore" file descriptor, if available.
1108  */
1109 int highscore_fd = -1;
1110
1111 /*
1112  * Should the monster allocation fail with inappropriate terrain?
1113  */
1114 bool monster_terrain_sensitive = TRUE;
1115
1116 int mutant_regenerate_mod = 100;
1117
1118 /*
1119  * Startup options
1120  */
1121 bool easy_band;
1122 bool vanilla_town;            /* Use "vanilla" town without set quests */
1123 bool ironman_shops;           /* Stores are permanently closed */
1124 bool ironman_small_levels;    /* Always create unusually small dungeon levels */
1125 bool ironman_downward;        /* Don't allow climbing upwards/recalling */
1126 bool ironman_autoscum;        /* Permanently enable the autoscummer */
1127 bool lite_town;               /* Use "lite" town without wilderness */
1128 bool ironman_empty_levels;    /* Always create empty 'arena' levels */
1129 bool terrain_streams;         /* Create terrain 'streamers' in the dungeon */
1130 bool munchkin_death;          /* Ask for saving death */
1131 bool ironman_rooms;           /* Always generate very unusual rooms */
1132 bool ironman_nightmare;                 /* Play the game in Nightmare mode */
1133 bool left_hander;
1134 bool preserve_mode;
1135 bool autoroller;
1136 bool autochara;
1137
1138
1139 bool use_transparency = FALSE; /* Use transparent tiles */
1140
1141 bool can_save = FALSE;         /* Game can be saved */
1142
1143 s16b spell_exp[64];           /* mahou keikenchi */
1144
1145 s16b weapon_exp[5][64];       /* weapon keikenchi */
1146
1147 s16b skill_exp[10];           /* ginou keikenchi */
1148
1149 bool world_monster;
1150 bool world_player;
1151
1152 s16b mane_spell[MAX_MANE];
1153 s16b mane_dam[MAX_MANE];
1154 s16b mane_num;
1155
1156 int cap_mon;
1157 int cap_mspeed;
1158 int cap_hp;
1159 int cap_maxhp;
1160 u16b cap_nickname;
1161
1162 s16b battle_mon[4];
1163 int sel_monster;
1164 int battle_odds;
1165 int kakekin;
1166 u32b mon_odds[4];
1167
1168 int pet_t_m_idx;
1169 int riding_t_m_idx;
1170
1171 s16b kubi_r_idx[MAX_KUBI];
1172 s16b today_mon;
1173
1174 monster_type riding_mon;
1175 monster_type party_mon[20];
1176
1177 bool write_level;
1178
1179 u32b playtime;
1180 u32b start_time;
1181
1182 int tsuri_dir;
1183
1184 bool sukekaku;
1185 bool new_mane;
1186
1187 bool mon_fight;
1188
1189 bool ambush_flag;
1190 bool generate_encounter;
1191
1192 /*
1193  * Which dungeon ?
1194  */
1195 byte dungeon_type;
1196 s16b *max_dlv;
1197
1198 byte feat_wall_outer;
1199 byte feat_wall_inner;
1200 byte feat_wall_solid;
1201 s16b floor_type[100], fill_type[100];
1202
1203 bool now_damaged;
1204 s16b now_message;
1205 bool use_menu;
1206
1207 #ifdef CHUUKEI
1208 bool chuukei_server;
1209 bool chuukei_client;
1210 char *server_name;
1211 int server_port;
1212 #endif