OSDN Git Service

無駄なobject_is_weapon_armour_ammo()呼び出しの削除.
[hengband/hengband.git] / src / variable.c
1 /* File: variable.c */
2
3 /*
4  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
5  *
6  * This software may be copied and distributed for educational, research,
7  * and not for profit purposes provided that this copyright and statement
8  * are included in all such copies.  Other copyrights may also apply.
9  */
10
11 /* Purpose: Angband variables */
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 cptr macro_template = NULL;
31 cptr macro_modifier_chr;
32 cptr macro_modifier_name[MAX_MACRO_MOD];
33 cptr macro_trigger_name[MAX_MACRO_TRIG];
34 cptr macro_trigger_keycode[2][MAX_MACRO_TRIG];
35
36 /* ¥ì¥Ù¥ë¥¢¥Ã¥×¤Î»þ¤Ë¾å¾ºÎ̤òɽ¼¨¤¹¤ë¤Î¤Ë»È¤¦ */
37 int level_up = 0;
38
39 /* 
40  *  List for auto-picker/destroyer entries
41  */
42 int max_autopick = 0;
43 int max_max_autopick = 0;
44 autopick_type *autopick_list = NULL;
45
46 /*
47  * Savefile version
48  */
49 byte h_ver_major;       /* Savefile version for Hengband 1.1.1 and later */
50 byte h_ver_minor;
51 byte h_ver_patch;
52 byte h_ver_extra;
53
54 byte sf_extra;          /* Savefile's encoding key */
55
56 byte z_major;           /* Savefile version for Hengband */
57 byte z_minor;
58 byte z_patch;
59
60 /*
61  * Savefile information
62  */
63 u32b sf_system;                 /* Operating system info */
64 u32b sf_when;                   /* Time when savefile created */
65 u16b sf_lives;                  /* Number of past "lives" with this file */
66 u16b sf_saves;                  /* Number of "saves" during this life */
67
68 /*
69  * Run-time arguments
70  */
71 bool arg_fiddle;                        /* Command arg -- Request fiddle mode */
72 bool arg_wizard;                        /* Command arg -- Request wizard mode */
73 bool arg_sound;                         /* Command arg -- Request special sounds */
74 byte arg_graphics;                      /* Command arg -- Request graphics mode */
75 bool arg_monochrome;            /* Command arg -- Request monochrome mode */
76 bool arg_force_original;        /* Command arg -- Request original keyset */
77 bool arg_force_roguelike;       /* Command arg -- Request roguelike keyset */
78 bool arg_bigtile = FALSE;       /* Command arg -- Request big tile mode */
79
80 /*
81  * Various things
82  */
83 bool character_generated;       /* The character exists */
84 bool character_dungeon;         /* The character has a dungeon */
85 bool character_loaded;          /* The character was loaded from a savefile */
86 bool character_saved;           /* The character was just saved to a savefile */
87
88 bool character_icky;            /* The game is in an icky full screen mode */
89 bool character_xtra;            /* The game is in an icky startup mode */
90
91 bool creating_savefile;         /* New savefile is currently created */
92
93 u32b seed_flavor;               /* Hack -- consistent object colors */
94 u32b seed_town;                 /* Hack -- consistent town layout */
95
96 s16b command_cmd;               /* Current "Angband Command" */
97
98 s16b command_arg;               /* Gives argument of current command */
99 s16b command_rep;               /* Gives repetition of current command */
100 s16b command_dir;               /* Gives direction of current command */
101
102 s16b command_see;               /* See "object1.c" */
103 s16b command_wrk;               /* See "object1.c" */
104
105 s16b command_gap = 999;         /* See "object1.c" */
106
107 s16b command_new;               /* Command chaining from inven/equip view */
108
109 s16b energy_use;                /* Energy use this turn */
110
111 bool msg_flag;                  /* Used in msg_print() for "buffering" */
112
113 s16b running;                   /* Current counter for running, if any */
114 s16b resting;                   /* Current counter for resting, if any */
115
116 s16b cur_hgt;                   /* Current dungeon height */
117 s16b cur_wid;                   /* Current dungeon width */
118 s16b dun_level;                 /* Current dungeon level */
119 s16b num_repro;                 /* Current reproducer count */
120 s16b object_level;              /* Current object creation level */
121 s16b monster_level;             /* Current monster creation level */
122 s16b base_level;        /* Base dungeon level */
123
124 s32b turn;                              /* Current game turn */
125 s32b turn_limit;                /* Limit of game turn */
126 s32b dungeon_turn;                      /* Game turn in dungeon */
127 s32b dungeon_turn_limit;        /* Limit of game turn in dungeon */
128 s32b old_turn;                  /* Turn when level began */
129 s32b old_battle;
130
131 bool use_sound;                 /* The "sound" mode is enabled */
132 bool use_graphics;              /* The "graphics" mode is enabled */
133 bool use_bigtile = FALSE;
134
135 s16b signal_count;              /* Hack -- Count interupts */
136
137 bool inkey_base;                /* See the "inkey()" function */
138 bool inkey_xtra;                /* See the "inkey()" function */
139 bool inkey_scan;                /* See the "inkey()" function */
140 bool inkey_flag;                /* See the "inkey()" function */
141
142 s16b coin_type;                 /* Hack -- force coin type */
143
144 bool opening_chest;             /* Hack -- prevent chest generation */
145
146 bool shimmer_monsters;  /* Hack -- optimize multi-hued monsters */
147 bool shimmer_objects;   /* Hack -- optimize multi-hued objects */
148
149 bool repair_monsters;   /* Hack -- optimize detect monsters */
150 bool repair_objects;    /* Hack -- optimize detect objects */
151
152 s16b inven_nxt;                 /* Hack -- unused */
153 bool hack_mind;
154 bool hack_mutation;
155
156 s16b inven_cnt;                 /* Number of items in inventory */
157 s16b equip_cnt;                 /* Number of items in equipment */
158
159 s16b o_max = 1;                 /* Number of allocated objects */
160 s16b o_cnt = 0;                 /* Number of live objects */
161
162 s16b m_max = 1;                 /* Number of allocated monsters */
163 s16b m_cnt = 0;                 /* Number of live monsters */
164
165 s16b hack_m_idx = 0;    /* Hack -- see "process_monsters()" */
166 s16b hack_m_idx_ii = 0;
167 bool multi_rew = FALSE;
168 char summon_kin_type;   /* Hack, by Julian Lighton: summon 'relatives' */
169
170 int total_friends = 0;
171 s32b friend_align = 0;
172
173 int leaving_quest = 0;
174 bool reinit_wilderness = FALSE;
175
176
177 /*
178  * Software options (set via the '=' command).  See "tables.c"
179  */
180
181 /*** Input Options ***/
182
183 bool rogue_like_commands;       /* Rogue-like commands */
184 bool always_pickup;     /* Pick things up by default */
185 bool carry_query_flag;  /* Prompt before picking things up */
186 bool quick_messages;    /* Activate quick messages */
187 bool auto_more; /* Automatically clear '-more-' prompts */
188 bool command_menu;      /* Enable command selection menu */
189 bool other_query_flag;  /* Prompt for floor item selection */
190 bool use_old_target;    /* Use old target by default */
191 bool always_repeat;     /* Repeat obvious commands */
192 bool confirm_destroy;   /* Prompt for destruction of known worthless items */
193 bool confirm_wear;      /* Confirm to wear/wield known cursed items */
194 bool confirm_quest;     /* Prompt before exiting a quest level */
195 bool target_pet;        /* Allow targetting pets */
196
197 #ifdef ALLOW_EASY_OPEN
198 bool easy_open; /* Automatically open doors */
199 #endif
200
201 #ifdef ALLOW_EASY_DISARM
202 bool easy_disarm;       /* Automatically disarm traps */
203 #endif
204
205 #ifdef ALLOW_EASY_FLOOR
206 bool easy_floor;        /* Display floor stacks in a list */
207 #endif
208
209 bool use_command;       /* Allow unified use command */
210 bool over_exert;        /* Allow casting spells when short of mana */
211 bool numpad_as_cursorkey;       /* Use numpad keys as cursor key in editor mode */
212
213
214 /*** Map Screen Options ***/
215
216 bool center_player;     /* Center map while walking (*slow*) */
217 bool center_running;    /* Centering even while running */
218 bool view_yellow_lite;  /* Use special colors for torch-lit grids */
219 bool view_bright_lite;  /* Use special colors for 'viewable' grids */
220 bool view_granite_lite; /* Use special colors for wall grids (slow) */
221 bool view_special_lite; /* Use special colors for floor grids (slow) */
222 bool view_perma_grids;  /* Map remembers all perma-lit grids */
223 bool view_torch_grids;  /* Map remembers all torch-lit grids */
224 bool view_unsafe_grids; /* Map marked by detect traps */
225 bool view_reduce_view;  /* Reduce view-radius in town */
226 bool fresh_before;      /* Flush output while continuous command */
227 bool fresh_after;       /* Flush output after monster's move */
228 bool fresh_message;     /* Flush output after every message */
229 bool hilite_player;     /* Hilite the player with the cursor */
230 bool display_path;      /* Display actual path before shooting */
231
232
233 /*** Text Display Options ***/
234
235 bool plain_descriptions;        /* Plain object descriptions */
236 bool plain_pickup;      /* Plain pickup messages(japanese only) */
237 bool always_show_list;  /* Always show list when choosing items */
238 bool depth_in_feet;     /* Show dungeon level in feet */
239 bool show_labels;       /* Show labels in object listings */
240 bool show_weights;      /* Show weights in object listings */
241 bool show_item_graph;   /* Show items graphics */
242 bool equippy_chars;     /* Display 'equippy' chars */
243 bool display_mutations; /* Display mutations in 'C'haracter Display */
244 bool compress_savefile; /* Compress messages in savefiles */
245 bool abbrev_extra;      /* Describe obj's extra resistances by abbreviation */
246 bool abbrev_all;        /* Describe obj's all resistances by abbreviation */
247 bool exp_need;  /* Show the experience needed for next level */
248 bool ignore_unview;     /* Ignore whenever any monster does */
249
250
251 /*** Game-Play Options ***/
252
253 bool stack_force_notes; /* Merge inscriptions when stacking */
254 bool stack_force_costs; /* Merge discounts when stacking */
255 bool expand_list;       /* Expand the power of the list commands */
256 bool small_levels;      /* Allow unusually small dungeon levels */
257 bool always_small_levels;       /* Always create unusually small dungeon levels */
258 bool empty_levels;      /* Allow empty 'arena' levels */
259 bool bound_walls_perm;  /* Boundary walls become 'permanent wall' */
260 bool last_words;        /* Leave last words when your character dies */
261
262 #ifdef WORLD_SCORE
263 bool send_score;        /* Send score dump to the world score server */
264 #endif
265
266 bool allow_debug_opts;  /* Allow use of debug/cheat options */
267
268
269 /*** Disturbance Options ***/
270
271 bool find_ignore_stairs;        /* Run past stairs */
272 bool find_ignore_doors; /* Run through open doors */
273 bool find_cut;  /* Run past known corners */
274 bool check_abort;       /* Check for user abort while continuous command */
275 bool flush_failure;     /* Flush input on various failures */
276 bool flush_disturb;     /* Flush input whenever disturbed */
277 bool disturb_move;      /* Disturb whenever any monster moves */
278 bool disturb_high;      /* Disturb whenever high-level monster moves */
279 bool disturb_near;      /* Disturb whenever viewable monster moves */
280 bool disturb_pets;      /* Disturb when visible pets move */
281 bool disturb_panel;     /* Disturb whenever map panel changes */
282 bool disturb_state;     /* Disturb whenever player state changes */
283 bool disturb_minor;     /* Disturb whenever boring things happen */
284 bool ring_bell; /* Audible bell (on errors, etc) */
285 bool disturb_trap_detect;       /* Disturb when leaving trap detected area */
286 bool alert_trap_detect; /* Alert when leaving trap detected area */
287
288
289 /*** Birth Options ***/
290
291 bool manual_haggle;     /* Manually haggle in stores */
292 bool easy_band; /* Easy Mode (*) */
293 bool smart_learn;       /* Monsters learn from their mistakes (*) */
294 bool smart_cheat;       /* Monsters exploit players weaknesses (*) */
295 bool vanilla_town;      /* Use 'vanilla' town without quests and wilderness */
296 bool lite_town; /* Use 'lite' town without a wilderness */
297 bool ironman_shops;     /* Stores are permanently closed (*) */
298 bool ironman_small_levels;      /* Always create unusually small dungeon levels (*) */
299 bool ironman_downward;  /* Disable recall and use of up stairs (*) */
300 bool ironman_empty_levels;      /* Always create empty 'arena' levels (*) */
301 bool ironman_rooms;     /* Always generate very unusual rooms (*) */
302 bool ironman_nightmare; /* Nightmare mode(it isn't even remotely fair!)(*) */
303 bool left_hander;       /* Left-Hander */
304 bool preserve_mode;     /* Preserve artifacts (*) */
305 bool autoroller;        /* Allow use of autoroller for stats (*) */
306 bool autochara; /* Autoroll for weight, height and social status */
307 bool powerup_home;      /* Increase capacity of your home (*) */
308
309
310 /*** Easy Object Auto-Destroyer ***/
311
312 bool destroy_items;     /* Use easy auto-destroyer */
313 bool destroy_feeling;   /* Apply auto-destroy as sense feeling */
314 bool destroy_identify;  /* Apply auto-destroy as identify an item */
315 bool leave_worth;       /* Auto-destroyer leaves known worthy items */
316 bool leave_equip;       /* Auto-destroyer leaves weapons and armour */
317 bool leave_chest;       /* Auto-destroyer leaves closed chests */
318 bool leave_wanted;      /* Auto-destroyer leaves wanted corpses */
319 bool leave_corpse;      /* Auto-destroyer leaves corpses and skeletons */
320 bool leave_junk;        /* Auto-destroyer leaves junk */
321 bool leave_special;     /* Auto-destroyer leaves items your race/class needs */
322
323
324 /*** Play-record Options ***/
325
326 bool record_fix_art;    /* Record fixed artifacts */
327 bool record_rand_art;   /* Record random artifacts */
328 bool record_destroy_uniq;       /* Record when destroy unique monster */
329 bool record_fix_quest;  /* Record fixed quests */
330 bool record_rand_quest; /* Record random quests */
331 bool record_maxdepth;   /* Record movements to deepest level */
332 bool record_stair;      /* Record recall and stair movements */
333 bool record_buy;        /* Record purchased items */
334 bool record_sell;       /* Record sold items */
335 bool record_danger;     /* Record hitpoint warning */
336 bool record_arena;      /* Record arena victories */
337 bool record_ident;      /* Record first identified items */
338 bool record_named_pet;  /* Record informations of named pets */
339
340
341 /* Cheating options */
342
343 bool cheat_peek;        /* Peek into object creation */
344 bool cheat_hear;        /* Peek into monster creation */
345 bool cheat_room;        /* Peek into dungeon creation */
346 bool cheat_xtra;        /* Peek into something else */
347 bool cheat_know;        /* Know complete monster info */
348 bool cheat_live;        /* Allow player to avoid death */
349 bool cheat_save;        /* Ask for saving death */
350
351
352 /* Special options */
353
354 byte hitpoint_warn;     /* Hitpoint warning (0 to 9) */
355 byte mana_warn; /* Mana color (0 to 9) */
356
357 byte delay_factor;      /* Delay factor (0 to 9) */
358
359 bool autosave_l;        /* Autosave before entering new levels */
360 bool autosave_t;        /* Timed autosave */
361 s16b autosave_freq;     /* Autosave frequency */
362
363
364 /*
365  * Dungeon variables
366  */
367
368 bool closing_flag;              /* Dungeon is closing */
369
370
371 /*
372  * Dungeon size info
373  */
374
375 s16b panel_row_min, panel_row_max;
376 s16b panel_col_min, panel_col_max;
377 s16b panel_col_prt, panel_row_prt;
378
379 /*
380  * Player location in dungeon
381  */
382 int py;
383 int px;
384
385 /*
386  * Targetting variables
387  */
388 s16b target_who;
389 s16b target_col;
390 s16b target_row;
391
392
393 /*
394  * User info
395  */
396 int player_uid;
397 int player_euid;
398 int player_egid;
399
400 /*
401  * Current player's character name
402  */
403 char player_name[32];
404
405 /*
406  * Stripped version of "player_name"
407  */
408 char player_base[32];
409
410
411 /*
412  * Buffer to hold the current savefile name
413  * 'savefile' holds full path name. 'savefile_base' holds only base name.
414  */
415 char savefile[1024];
416 char savefile_base[40];
417
418 /*
419  * Array of grids lit by player lite (see "cave.c")
420  */
421 s16b lite_n;
422 s16b lite_y[LITE_MAX];
423 s16b lite_x[LITE_MAX];
424
425 /*
426  * Array of grids lit by player lite (see "cave.c")
427  */
428 s16b mon_lite_n;
429 s16b mon_lite_y[MON_LITE_MAX];
430 s16b mon_lite_x[MON_LITE_MAX];
431
432 /*
433  * Array of grids viewable to the player (see "cave.c")
434  */
435 s16b view_n;
436 byte view_y[VIEW_MAX];
437 byte view_x[VIEW_MAX];
438
439 /*
440  * Array of grids for use by various functions (see "cave.c")
441  */
442 s16b temp_n;
443 byte temp_y[TEMP_MAX];
444 byte temp_x[TEMP_MAX];
445
446 /*
447  * Array of grids for delayed visual updating (see "cave.c")
448  */
449 s16b redraw_n = 0;
450 byte redraw_y[REDRAW_MAX];
451 byte redraw_x[REDRAW_MAX];
452
453
454 /*
455  * Number of active macros.
456  */
457 s16b macro__num;
458
459 /*
460  * Array of macro patterns [MACRO_MAX]
461  */
462 cptr *macro__pat;
463
464 /*
465  * Array of macro actions [MACRO_MAX]
466  */
467 cptr *macro__act;
468
469 /*
470  * Array of macro types [MACRO_MAX]
471  */
472 bool *macro__cmd;
473
474 /*
475  * Current macro action [1024]
476  */
477 char *macro__buf;
478
479
480 /*
481  * The number of quarks
482  */
483 s16b quark__num;
484
485 /*
486  * The pointers to the quarks [QUARK_MAX]
487  */
488 cptr *quark__str;
489
490
491 /*
492  * The next "free" index to use
493  */
494 u16b message__next;
495
496 /*
497  * The index of the oldest message (none yet)
498  */
499 u16b message__last;
500
501 /*
502  * The next "free" offset
503  */
504 u16b message__head;
505
506 /*
507  * The offset to the oldest used char (none yet)
508  */
509 u16b message__tail;
510
511 /*
512  * The array of offsets, by index [MESSAGE_MAX]
513  */
514 u16b *message__ptr;
515
516 /*
517  * The array of chars, by offset [MESSAGE_BUF]
518  */
519 char *message__buf;
520
521
522 /*
523  * The array of normal options
524  */
525 u32b option_flag[8];
526 u32b option_mask[8];
527
528
529 /*
530  * The array of window options
531  */
532 u32b window_flag[8];
533 u32b window_mask[8];
534
535
536 /*
537  * The array of window pointers
538  */
539 term *angband_term[8];
540
541
542 /*
543  * Standard window names
544  */
545 char angband_term_name[8][16] =
546 {
547         "Hengband",
548         "Term-1",
549         "Term-2",
550         "Term-3",
551         "Term-4",
552         "Term-5",
553         "Term-6",
554         "Term-7"
555 };
556
557
558 /*
559  * Global table of color definitions
560  */
561 byte angband_color_table[256][4] =
562 {
563         {0x00, 0x00, 0x00, 0x00},       /* TERM_DARK */
564         {0x00, 0xFF, 0xFF, 0xFF},       /* TERM_WHITE */
565         {0x00, 0x80, 0x80, 0x80},       /* TERM_SLATE */
566         {0x00, 0xFF, 0x80, 0x00},       /* TERM_ORANGE */
567         {0x00, 0xC0, 0x00, 0x00},       /* TERM_RED */
568         {0x00, 0x00, 0x80, 0x40},       /* TERM_GREEN */
569         {0x00, 0x00, 0x00, 0xFF},       /* TERM_BLUE */
570         {0x00, 0x80, 0x40, 0x00},       /* TERM_UMBER */
571         {0x00, 0x40, 0x40, 0x40},       /* TERM_L_DARK */
572         {0x00, 0xC0, 0xC0, 0xC0},       /* TERM_L_WHITE */
573         {0x00, 0xFF, 0x00, 0xFF},       /* TERM_VIOLET */
574         {0x00, 0xFF, 0xFF, 0x00},       /* TERM_YELLOW */
575         {0x00, 0xFF, 0x00, 0x00},       /* TERM_L_RED */
576         {0x00, 0x00, 0xFF, 0x00},       /* TERM_L_GREEN */
577         {0x00, 0x00, 0xFF, 0xFF},       /* TERM_L_BLUE */
578         {0x00, 0xC0, 0x80, 0x40}        /* TERM_L_UMBER */
579 };
580
581
582 /*
583  * Standard sound names
584  */
585 char angband_sound_name[SOUND_MAX][16] =
586 {
587         "",
588         "hit",
589         "miss",
590         "flee",
591         "drop",
592         "kill",
593         "level",
594         "death",
595         "study",
596         "teleport",
597         "shoot",
598         "quaff",
599         "zap",
600         "walk",
601         "tpother",
602         "hitwall",
603         "eat",
604         "store1",
605         "store2",
606         "store3",
607         "store4",
608         "dig",
609         "opendoor",
610         "shutdoor",
611         "tplevel",
612         "scroll",
613         "buy",
614         "sell",
615         "warn",
616         "rocket",
617         "n_kill",
618         "u_kill",
619         "quest",
620         "heal",
621         "x_heal",
622         "bite",
623         "claw",
624         "m_spell",
625         "summon",
626         "breath",
627         "ball",
628         "m_heal",
629         "atkspell",
630         "evil",
631         "touch",
632         "sting",
633         "crush",
634         "slime",
635         "wail",
636         "winner",
637         "fire",
638         "acid",
639         "elec",
640         "cold",
641         "illegal",
642         "fail",
643         "wakeup",
644         "invuln",
645         "fall",
646         "pain",
647         "destitem",
648         "moan",
649         "show",
650         "unused",
651         "explode",
652         "glass",
653 };
654
655
656 /*
657  * The array of "cave grids" [MAX_WID][MAX_HGT].
658  * Not completely allocated, that would be inefficient
659  * Not completely hardcoded, that would overflow memory
660  */
661 cave_type *cave[MAX_HGT];
662
663
664 /*
665  * The array of saved floors
666  */
667 saved_floor_type saved_floors[MAX_SAVED_FLOORS];
668
669
670 /*
671  * Number of floor_id used from birth
672  */
673 s16b max_floor_id;
674
675
676 /*
677  * Sign for current process used in temporal files.
678  * Actually it is the start time of current process.
679  */
680 u32b saved_floor_file_sign;
681
682
683 /*
684  * The array of dungeon items [max_o_idx]
685  */
686 object_type *o_list;
687
688 /*
689  * The array of dungeon monsters [max_m_idx]
690  */
691 monster_type *m_list;
692
693 /*
694  * The array to process dungeon monsters [max_m_idx]
695  */
696 s16b *mproc_list[MAX_MTIMED];
697 s16b mproc_max[MAX_MTIMED]; /* Number of monsters to be processed */
698
699
700 /*
701  * Maximum number of towns
702  */
703 u16b max_towns;
704
705 /*
706  * The towns [max_towns]
707  */
708 town_type *town;
709
710
711 /*
712  * The player's inventory [INVEN_TOTAL]
713  */
714 object_type *inventory;
715
716
717 /*
718  * The size of "alloc_kind_table" (at most max_k_idx * 4)
719  */
720 s16b alloc_kind_size;
721
722 /*
723  * The entries in the "kind allocator table"
724  */
725 alloc_entry *alloc_kind_table;
726
727
728 /*
729  * The size of "alloc_race_table" (at most max_r_idx)
730  */
731 s16b alloc_race_size;
732
733 /*
734  * The entries in the "race allocator table"
735  */
736 alloc_entry *alloc_race_table;
737
738
739 /*
740  * Specify attr/char pairs for visual special effects
741  * Be sure to use "index & 0x7F" to avoid illegal access
742  */
743 byte misc_to_attr[256];
744 char misc_to_char[256];
745
746
747 /*
748  * Specify attr/char pairs for inventory items (by tval)
749  * Be sure to use "index & 0x7F" to avoid illegal access
750  */
751 byte tval_to_attr[128];
752 char tval_to_char[128];
753
754
755 /*
756  * Keymaps for each "mode" associated with each keypress.
757  */
758 cptr keymap_act[KEYMAP_MODES][256];
759
760
761
762 /*** Player information ***/
763
764 /*
765  * Static player info record
766  */
767 player_type p_body;
768
769 /*
770  * Pointer to the player info
771  */
772 player_type *p_ptr = &p_body;
773
774 /*
775  * Pointer to the player tables
776  * (sex, race, class, magic)
777  */
778 player_sex *sp_ptr;
779 player_race *rp_ptr;
780 player_class *cp_ptr;
781 player_seikaku *ap_ptr;
782 player_magic *mp_ptr;
783
784
785 /*
786  * The last character rolled,
787  * holded for quick start
788  */
789 birther previous_char;
790
791
792 /*
793  * The vault generation arrays
794  */
795 vault_type *v_info;
796 char *v_name;
797 char *v_text;
798
799 /*
800  * The skill table
801  */
802 skill_table *s_info;
803
804 /*
805  * The magic info
806  */
807 player_magic *m_info;
808
809 /*
810  * The terrain feature arrays
811  */
812 feature_type *f_info;
813 char *f_name;
814 char *f_tag;
815
816 /*
817  * The object kind arrays
818  */
819 object_kind *k_info;
820 char *k_name;
821 char *k_text;
822
823 /*
824  * The artifact arrays
825  */
826 artifact_type *a_info;
827 char *a_name;
828 char *a_text;
829
830 /*
831  * The ego-item arrays
832  */
833 ego_item_type *e_info;
834 char *e_name;
835 char *e_text;
836
837
838 /*
839  * The monster race arrays
840  */
841 monster_race *r_info;
842 char *r_name;
843 char *r_text;
844
845
846 /*
847  * The dungeon arrays
848  */
849 dungeon_info_type *d_info;
850 char *d_name;
851 char *d_text;
852
853
854 /*
855  * Hack -- The special Angband "System Suffix"
856  * This variable is used to choose an appropriate "pref-xxx" file
857  */
858 cptr ANGBAND_SYS = "xxx";
859
860 /*
861  * Hack -- The special Angband "Keyboard Suffix"
862  * This variable is used to choose an appropriate macro-trigger definition
863  */
864 #ifdef JP
865 cptr ANGBAND_KEYBOARD = "JAPAN";
866 #else
867 cptr ANGBAND_KEYBOARD = "0";
868 #endif
869
870 /*
871  * Hack -- The special Angband "Graphics Suffix"
872  * This variable is used to choose an appropriate "graf-xxx" file
873  */
874 cptr ANGBAND_GRAF = "ascii";
875
876 /*
877  * Path name: The main "lib" directory
878  * This variable is not actually used anywhere in the code
879  */
880 cptr ANGBAND_DIR;
881
882 /*
883  * High score files (binary)
884  * These files may be portable between platforms
885  */
886 cptr ANGBAND_DIR_APEX;
887
888 /*
889  * Bone files for player ghosts (ascii)
890  * These files are portable between platforms
891  */
892 cptr ANGBAND_DIR_BONE;
893
894 /*
895  * Binary image files for the "*_info" arrays (binary)
896  * These files are not portable between platforms
897  */
898 cptr ANGBAND_DIR_DATA;
899
900 /*
901  * Textual template files for the "*_info" arrays (ascii)
902  * These files are portable between platforms
903  */
904 cptr ANGBAND_DIR_EDIT;
905
906 /*
907  * Script files
908  * These files are portable between platforms.
909  */
910 cptr ANGBAND_DIR_SCRIPT;
911
912 /*
913  * Various extra files (ascii)
914  * These files may be portable between platforms
915  */
916 cptr ANGBAND_DIR_FILE;
917
918 /*
919  * Help files (normal) for the online help (ascii)
920  * These files are portable between platforms
921  */
922 cptr ANGBAND_DIR_HELP;
923
924 /*
925  * Help files (spoilers) for the online help (ascii)
926  * These files are portable between platforms
927  */
928 cptr ANGBAND_DIR_INFO;
929
930 /*
931  * Default user "preference" files (ascii)
932  * These files are rarely portable between platforms
933  */
934 cptr ANGBAND_DIR_PREF;
935
936 /*
937  * Savefiles for current characters (binary)
938  * These files are portable between platforms
939  */
940 cptr ANGBAND_DIR_SAVE;
941
942 /*
943  * User "preference" files (ascii)
944  * These files are rarely portable between platforms
945  */
946 cptr ANGBAND_DIR_USER;
947
948 /*
949  * Various extra files (binary)
950  * These files are rarely portable between platforms
951  */
952 cptr ANGBAND_DIR_XTRA;
953
954
955 /*
956  * Total Hack -- allow all items to be listed (even empty ones)
957  * This is only used by "do_cmd_inven_e()" and is cleared there.
958  */
959 bool item_tester_full;
960
961 bool item_tester_no_ryoute = FALSE;
962
963 /*
964  * Here is a "pseudo-hook" used during calls to "get_item()" and
965  * "show_inven()" and "show_equip()", and the choice window routines.
966  */
967 byte item_tester_tval;
968
969
970 /*
971  * Here is a "hook" used during calls to "get_item()" and
972  * "show_inven()" and "show_equip()", and the choice window routines.
973  */
974 bool (*item_tester_hook)(object_type*);
975
976
977
978 /*
979  * Current "comp" function for ang_sort()
980  */
981 bool (*ang_sort_comp)(vptr u, vptr v, int a, int b);
982
983
984 /*
985  * Current "swap" function for ang_sort()
986  */
987 void (*ang_sort_swap)(vptr u, vptr v, int a, int b);
988
989
990
991 /*
992  * Hack -- function hooks to restrict "get_mon_num_prep()" function
993  */
994 monster_hook_type get_mon_num_hook;
995 monster_hook_type get_mon_num2_hook;
996
997
998 /*
999  * Hack -- function hook to restrict "get_obj_num_prep()" function
1000  */
1001 bool (*get_obj_num_hook)(int k_idx);
1002
1003
1004 /* Hack, monk armour */
1005 bool monk_armour_aux;
1006 bool monk_notify_aux;
1007
1008 #ifdef ALLOW_EASY_OPEN /* TNB */
1009 bool easy_open;
1010 #endif /* ALLOW_EASY_OPEN -- TNB */
1011
1012 #ifdef ALLOW_EASY_DISARM /* TNB */
1013 bool easy_disarm;
1014 #endif /* ALLOW_EASY_DISARM -- TNB */
1015
1016 #ifdef ALLOW_EASY_FLOOR /* TNB */
1017 bool easy_floor;
1018 #endif /* ALLOW_EASY_FLOOR -- TNB */
1019
1020 bool use_command;
1021 bool center_player;
1022 bool center_running;
1023
1024 /* Auto-destruction options */
1025 bool destroy_items;
1026 bool destroy_feeling;
1027 bool destroy_identify;
1028 bool leave_worth;
1029 bool leave_equip;
1030 bool leave_wanted;
1031 bool leave_corpse;
1032 bool leave_junk;
1033 bool leave_chest;
1034 bool leave_special;
1035
1036 /* Nikki */
1037 bool record_fix_art;
1038 bool record_rand_art;
1039 bool record_destroy_uniq;
1040 bool record_fix_quest;
1041 bool record_rand_quest;
1042 bool record_maxdepth;
1043 bool record_stair;
1044 bool record_buy;
1045 bool record_sell;
1046 bool record_danger;
1047 bool record_arena;
1048 bool record_ident;
1049 bool record_named_pet;
1050 char record_o_name[MAX_NLEN];
1051 s32b record_turn;
1052
1053 /*
1054  * Wilderness
1055  */
1056 wilderness_type **wilderness;
1057
1058
1059 /*
1060  * Buildings
1061  */
1062 building_type building[MAX_BLDG];
1063
1064
1065 /*
1066  * Maximum number of quests
1067  */
1068 u16b max_quests;
1069
1070 /*
1071  * Maximum number of monsters in r_info.txt
1072  */
1073 u16b max_r_idx;
1074
1075 /*
1076  * Maximum number of items in k_info.txt
1077  */
1078 u16b max_k_idx;
1079
1080 /*
1081  * Maximum number of vaults in v_info.txt
1082  */
1083 u16b max_v_idx;
1084
1085 /*
1086  * Maximum number of terrain features in f_info.txt
1087  */
1088 u16b max_f_idx;
1089
1090 /*
1091  * Maximum number of artifacts in a_info.txt
1092  */
1093 u16b max_a_idx;
1094
1095 /*
1096  * Maximum number of ego-items in e_info.txt
1097  */
1098 u16b max_e_idx;
1099
1100 /*
1101  * Maximum number of dungeon in e_info.txt
1102  */
1103 u16b max_d_idx;
1104
1105 /*
1106  * Maximum number of objects in the level
1107  */
1108 u16b max_o_idx;
1109
1110 /*
1111  * Maximum number of monsters in the level
1112  */
1113 u16b max_m_idx;
1114
1115 /*
1116  * Maximum size of the wilderness
1117  */
1118 s32b max_wild_x;
1119 s32b max_wild_y;
1120
1121 /*
1122  * Quest info
1123  */
1124 quest_type *quest;
1125
1126 /*
1127  * Quest text
1128  */
1129 char quest_text[10][80];
1130
1131 /*
1132  * Current line of the quest text
1133  */
1134 int quest_text_line;
1135
1136 /*
1137  * Default spell color table (quark index)
1138  */
1139 s16b gf_color[MAX_GF];
1140
1141 /*
1142  * Flags for initialization
1143  */
1144 int init_flags;
1145
1146
1147 /*
1148  * The "highscore" file descriptor, if available.
1149  */
1150 int highscore_fd = -1;
1151
1152 int mutant_regenerate_mod = 100;
1153
1154 bool can_save = FALSE;        /* Game can be saved */
1155
1156 s16b world_monster;
1157 bool world_player;
1158
1159 int cap_mon;
1160 int cap_mspeed;
1161 int cap_hp;
1162 int cap_maxhp;
1163 u16b cap_nickname;
1164
1165 s16b battle_mon[4];
1166 int sel_monster;
1167 int battle_odds;
1168 int kakekin;
1169 u32b mon_odds[4];
1170
1171 int pet_t_m_idx;
1172 int riding_t_m_idx;
1173
1174 s16b kubi_r_idx[MAX_KUBI];
1175 s16b today_mon;
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 cptr screen_dump = NULL;
1193
1194 /*** Terrain feature variables ***/
1195
1196 /* Nothing */
1197 s16b feat_none;
1198
1199 /* Floor */
1200 s16b feat_floor;
1201
1202 /* Objects */
1203 s16b feat_glyph;
1204 s16b feat_explosive_rune;
1205 s16b feat_mirror;
1206
1207 /* Doors */
1208 door_type feat_door[MAX_DOOR_TYPES];
1209
1210 /* Stairs */
1211 s16b feat_up_stair;
1212 s16b feat_down_stair;
1213 s16b feat_entrance;
1214
1215 /* Special traps */
1216 s16b feat_trap_open;
1217 s16b feat_trap_armageddon;
1218 s16b feat_trap_piranha;
1219
1220 /* Rubble */
1221 s16b feat_rubble;
1222
1223 /* Seams */
1224 s16b feat_magma_vein;
1225 s16b feat_quartz_vein;
1226
1227 /* Walls */
1228 s16b feat_granite;
1229 s16b feat_permanent;
1230
1231 /* Glass floor */
1232 s16b feat_glass_floor;
1233
1234 /* Glass walls */
1235 s16b feat_glass_wall;
1236 s16b feat_permanent_glass_wall;
1237
1238 /* Pattern */
1239 s16b feat_pattern_start;
1240 s16b feat_pattern_1;
1241 s16b feat_pattern_2;
1242 s16b feat_pattern_3;
1243 s16b feat_pattern_4;
1244 s16b feat_pattern_end;
1245 s16b feat_pattern_old;
1246 s16b feat_pattern_exit;
1247 s16b feat_pattern_corrupted;
1248
1249 /* Various */
1250 s16b feat_black_market;
1251 s16b feat_town;
1252
1253 /* Terrains */
1254 s16b feat_deep_water;
1255 s16b feat_shallow_water;
1256 s16b feat_deep_lava;
1257 s16b feat_shallow_lava;
1258 s16b feat_dirt;
1259 s16b feat_grass;
1260 s16b feat_flower;
1261 s16b feat_brake;
1262 s16b feat_tree;
1263 s16b feat_mountain;
1264 s16b feat_swamp;
1265
1266 /* Unknown grid (not detected) */
1267 s16b feat_undetected;
1268
1269 /*
1270  * Which dungeon ?
1271  */
1272 byte dungeon_type;
1273 s16b *max_dlv;
1274
1275 s16b feat_wall_outer;
1276 s16b feat_wall_inner;
1277 s16b feat_wall_solid;
1278 s16b floor_type[100], fill_type[100];
1279
1280 bool now_damaged;
1281 s16b now_message;
1282 bool use_menu;
1283
1284 #ifdef CHUUKEI
1285 bool chuukei_server;
1286 bool chuukei_client;
1287 char *server_name;
1288 int server_port;
1289 #endif