OSDN Git Service

[Refactor] #37353 term_screen マクロを util.h へ移動.
[hengband/hengband.git] / src / util.h
1 #pragma once
2
3 /*
4  * Sort-array element
5  */
6 typedef struct tag_type tag_type;
7
8 struct tag_type
9 {
10         int tag;
11         int index;
12 };
13
14 /*
15  * An entry for the object/monster allocation functions
16  *
17  * Pass 1 is determined from allocation information
18  * Pass 2 is determined from allocation restriction
19  * Pass 3 is determined from allocation calculation
20  */
21
22 typedef struct alloc_entry alloc_entry;
23
24 struct alloc_entry
25 {
26         KIND_OBJECT_IDX index;          /* The actual index */
27
28         DEPTH level;            /* Base dungeon level */
29         PROB prob1;             /* Probability, pass 1 */
30         PROB prob2;             /* Probability, pass 2 */
31         PROB prob3;             /* Probability, pass 3 */
32
33         u16b total;             /* Unused for now */
34 };
35
36 extern u32b message__next;
37 extern u32b message__last;
38 extern u32b message__head;
39 extern u32b message__tail;
40 extern u32b *message__ptr;
41 extern char *message__buf;
42
43 extern bool msg_flag;
44
45 extern s16b macro__num;
46 extern concptr *macro__pat;
47 extern concptr *macro__act;
48 extern bool *macro__cmd;
49 extern char *macro__buf;
50
51 extern bool get_com_no_macros;
52
53 extern bool inkey_base;
54 extern bool inkey_xtra;
55 extern bool inkey_scan;
56 extern bool inkey_flag;
57
58 /*
59  * Automatically generated "variable" declarations
60  */
61 extern int max_macrotrigger;
62 extern concptr macro_template;
63 extern concptr macro_modifier_chr;
64 extern concptr macro_modifier_name[MAX_MACRO_MOD];
65 extern concptr macro_trigger_name[MAX_MACRO_TRIG];
66 extern concptr macro_trigger_keycode[2][MAX_MACRO_TRIG];
67
68 extern COMMAND_CODE command_cmd;
69 extern COMMAND_ARG command_arg;
70 extern s16b command_rep;
71 extern DIRECTION command_dir;
72 extern s16b command_see;
73 extern TERM_LEN command_gap;
74 extern s16b command_wrk;
75 extern s16b command_new;
76
77 extern concptr keymap_act[KEYMAP_MODES][256];
78
79
80 /*
81  * Hack -- The main "screen"
82  */
83 #define term_screen     (angband_term[0])
84
85 /*
86  * Hack -- conditional (or "bizarre") externs
87  */
88
89 #ifdef SET_UID
90 extern void user_name(char *buf, int id);
91 #endif
92
93 #if 0
94 #ifndef HAS_STRICMP
95 extern int stricmp(concptr a, concptr b);
96 #endif
97 #endif
98
99 #ifndef HAVE_USLEEP
100 extern int usleep(huge usecs);
101 #endif
102
103 extern const char hexsym[16];
104
105 /* util.c */
106 extern errr path_parse(char *buf, int max, concptr file);
107 extern errr path_build(char *buf, int max, concptr path, concptr file);
108 extern FILE *my_fopen(concptr file, concptr mode);
109 extern FILE *my_fopen_temp(char *buf, int max);
110 extern errr my_fgets(FILE *fff, char *buf, huge n);
111 extern errr my_fputs(FILE *fff, concptr buf, huge n);
112 extern errr my_fclose(FILE *fff);
113 extern errr fd_kill(concptr file);
114 extern errr fd_move(concptr file, concptr what);
115 extern errr fd_copy(concptr file, concptr what);
116 extern int fd_make(concptr file, BIT_FLAGS mode);
117 extern int fd_open(concptr file, int flags);
118 extern errr fd_lock(int fd, int what);
119 extern errr fd_seek(int fd, huge n);
120 extern errr fd_chop(int fd, huge n);
121 extern errr fd_read(int fd, char *buf, huge n);
122 extern errr fd_write(int fd, concptr buf, huge n);
123 extern errr fd_close(int fd);
124 extern void flush(void);
125 extern void bell(void);
126 extern errr play_music(int type, int num);
127 extern void select_floor_music(void);
128 extern void sound(int num);
129 extern void move_cursor(int row, int col);
130 extern void text_to_ascii(char *buf, concptr str);
131 extern void ascii_to_text(char *buf, concptr str);
132 extern errr macro_add(concptr pat, concptr act);
133 extern sint macro_find_exact(concptr pat);
134 extern char inkey(void);
135 extern concptr quark_str(STR_OFFSET num);
136 extern void quark_init(void);
137 extern u16b quark_add(concptr str);
138 extern s32b message_num(void);
139 extern concptr message_str(int age);
140 extern void message_add(concptr msg);
141 extern void msg_erase(void);
142 extern void msg_print(concptr msg);
143 extern void msg_print_wizard(int cheat_type, concptr msg);
144 #ifndef SWIG
145 extern void msg_format(concptr fmt, ...);
146 extern void msg_format_wizard(int cheat_type, concptr fmt, ...);
147 #endif /* SWIG */
148 extern void screen_save(void);
149 extern void screen_load(void);
150 extern void c_put_str(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col);
151 extern void put_str(concptr str, TERM_LEN row, TERM_LEN col);
152 extern void c_prt(TERM_COLOR attr, concptr str, TERM_LEN row, TERM_LEN col);
153 extern void prt(concptr str, TERM_LEN row, TERM_LEN col);
154 extern void c_roff(TERM_COLOR attr, concptr str);
155 extern void roff(concptr str);
156 extern void clear_from(int row);
157 extern bool askfor_aux(char *buf, int len, bool numpad_cursor);
158 extern bool askfor(char *buf, int len);
159 extern bool get_string(concptr prompt, char *buf, int len);
160 extern bool get_check(concptr prompt);
161 extern bool get_check_strict(concptr prompt, BIT_FLAGS mode);
162 extern bool get_com(concptr prompt, char *command, bool z_escape);
163 extern QUANTITY get_quantity(concptr prompt, QUANTITY max);
164 extern void pause_line(int row);
165 extern void request_command(int shopping);
166 extern bool is_a_vowel(int ch);
167 extern int get_keymap_dir(char ch);
168 extern errr type_string(concptr str, uint len);
169 extern void roff_to_buf(concptr str, int wlen, char *tbuf, size_t bufsize);
170
171 #ifdef SORT_R_INFO
172 extern void tag_sort(tag_type elements[], int number);
173 #endif /* SORT_R_INFO */
174
175 #ifdef SUPPORT_GAMMA
176 extern byte gamma_table[256];
177 extern void build_gamma_table(int gamma);
178 #endif /* SUPPORT_GAMMA */
179
180 extern size_t my_strcpy(char *buf, concptr src, size_t bufsize);
181 extern size_t my_strcat(char *buf, concptr src, size_t bufsize);
182 extern char *my_strstr(concptr haystack, concptr needle);
183 extern char *my_strchr(concptr ptr, char ch);
184 extern void str_tolower(char *str);
185 extern int inkey_special(bool numpad_cursor);
186
187 /* util.c */
188 extern void repeat_push(COMMAND_CODE what);
189 extern bool repeat_pull(COMMAND_CODE *what);
190 extern void repeat_check(void);