OSDN Git Service

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