OSDN Git Service

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