OSDN Git Service

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