OSDN Git Service

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