OSDN Git Service

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