}
for (j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
handle_stuff(creature_ptr);
if (creature_ptr->prace == RACE_ANDROID) calc_android_exp(creature_ptr);
- term *old = Term;
+ term_type *old = Term;
for (int j = 0; j < 8; j++)
{
if (!angband_term[j]) continue;
static void disable_chuukei_server(void)
{
- term *t = angband_term[0];
+ term_type *t = angband_term[0];
#ifdef CHUUKEI
chuukei_server = FALSE;
#endif /* CHUUKEI */
*/
void prepare_chuukei_hooks(void)
{
- term *t0 = angband_term[0];
+ term_type *t0 = angband_term[0];
/* Save original z-term hooks */
old_xtra_hook = t0->xtra_hook;
{
char ch = 0;
bool done = FALSE;
- term *old = Term;
+ term_type *old = Term;
if (inkey_next && *inkey_next && !inkey_xtra) {
ch = *inkey_next++;
* </p>
*/
typedef struct {
- term t;
+ term_type t;
concptr s;
HWND w;
DWORD dwStyle;
}
for (int i = 0; i < MAX_TERM_DATA; i++) {
- term *old = Term;
+ term_type *old = Term;
term_data *td = &data[i];
if ((td->cols != td->t.wid) || (td->rows != td->t.hgt)) {
term_activate(&td->t);
*/
static void term_data_link(term_data *td)
{
- term *t = &td->t;
+ term_type *t = &td->t;
term_init(t, td->cols, td->rows, td->keys);
t->soft_cursor = TRUE;
t->higher_pict = TRUE;
}
}
+/*
+ * Add a keypress to the "queue"
+ */
+static errr term_keypress(int k)
+{
+ /* Refuse to enqueue non-keys */
+ if (!k)
+ return -1;
+
+ /* Store the char, advance the queue */
+ Term->key_queue[Term->key_head++] = (char)k;
+
+ /* Circular queue, handle wrap */
+ if (Term->key_head == Term->key_size)
+ Term->key_head = 0;
+
+ if (Term->key_head != Term->key_tail)
+ return 0;
+
+ return 1;
+}
+
static bool process_keydown(WPARAM wParam, LPARAM lParam)
{
bool mc = FALSE;
TERM_LEN cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;
TERM_LEN rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;
if ((td->cols != cols) || (td->rows != rows)) {
- term *old_term = Term;
+ term_type *old_term = Term;
td->cols = cols;
td->rows = rows;
term_activate(&td->t);
#if !defined(WINDOWS)
/*
+ * Nuke a term
+ */
+static errr term_nuke(term_type *t)
+{
+ TERM_LEN w = t->wid;
+ TERM_LEN h = t->hgt;
+
+ /* Call the special "nuke" hook */
+ if (t->active_flag) {
+ /* Call the "nuke" hook */
+ if (t->nuke_hook)
+ (*t->nuke_hook)(t);
+
+ /* Remember */
+ t->active_flag = FALSE;
+
+ /* Assume not mapped */
+ t->mapped_flag = FALSE;
+ }
+
+ /* Nuke "displayed" */
+ term_win_nuke(t->old, w, h);
+
+ /* Kill "displayed" */
+ KILL(t->old, term_win);
+
+ /* Nuke "requested" */
+ term_win_nuke(t->scr, w, h);
+
+ /* Kill "requested" */
+ KILL(t->scr, term_win);
+
+ /* If needed */
+ if (t->mem) {
+ /* Nuke "memorized" */
+ term_win_nuke(t->mem, w, h);
+
+ /* Kill "memorized" */
+ KILL(t->mem, term_win);
+ }
+
+ /* If needed */
+ if (t->tmp) {
+ /* Nuke "temporary" */
+ term_win_nuke(t->tmp, w, h);
+
+ /* Kill "temporary" */
+ KILL(t->tmp, term_win);
+ }
+
+ /* Free some arrays */
+ C_KILL(t->x1, h, TERM_LEN);
+ C_KILL(t->x2, h, TERM_LEN);
+
+ /* Free the input queue */
+ C_KILL(t->key_queue, t->key_size, char);
+ return 0;
+}
+
+/*
* A hook for "quit()".
*
* Close down, then fall back into "quit()".
return get_damage;
}
+#ifdef JP
+/*
+ * Move to a location and, using an attr, add a string vertically
+ */
+static errr term_putstr_v(TERM_LEN x, TERM_LEN y, int n, byte a, concptr s)
+{
+ errr res;
+ int y0 = y;
+
+ for (int i = 0; i < n && s[i] != 0; i++) {
+ /* Move first */
+ if ((res = term_gotoxy(x, y0)) != 0)
+ return (res);
+
+ if (iskanji(s[i])) {
+ if ((res = term_addstr(2, a, &s[i])) != 0)
+ return (res);
+ i++;
+ y0++;
+ if (s[i] == 0)
+ break;
+ } else {
+ if ((res = term_addstr(1, a, &s[i])) != 0)
+ return (res);
+ y0++;
+ }
+ }
+
+ return 0;
+}
+#endif
+
/*
* Decreases players hit points and sets death flag if necessary
*
/*
* The array of window pointers
*/
-term *angband_term[8];
+term_type *angband_term[8];
/*!
* スクリーン表示色キャラクタ /
extern const concptr window_flag_desc[32];
extern const concptr ident_info[];
-extern term *angband_term[8];
+extern term_type *angband_term[8];
#define term_screen (angband_term[0])
extern TERM_COLOR misc_to_attr[256];
#endif
/* The current "term" */
-term *Term = NULL;
+term_type *Term = NULL;
/*** Local routines ***/
* a valid location, so the first "n" characters of "s" can all be added
* starting at (x,y) without causing any illegal operations.
*/
-void term_queue_chars(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, concptr s)
+static void term_queue_chars(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, concptr s)
{
TERM_LEN x1 = -1, x2 = -1;
return 0;
}
-#ifdef JP
-/*
- * Move to a location and, using an attr, add a string vertically
- */
-errr term_putstr_v(TERM_LEN x, TERM_LEN y, int n, byte a, concptr s)
-{
- errr res;
- int y0 = y;
-
- for (int i = 0; i < n && s[i] != 0; i++) {
- /* Move first */
- if ((res = term_gotoxy(x, y0)) != 0)
- return (res);
-
- if (iskanji(s[i])) {
- if ((res = term_addstr(2, a, &s[i])) != 0)
- return (res);
- i++;
- y0++;
- if (s[i] == 0)
- break;
- } else {
- if ((res = term_addstr(1, a, &s[i])) != 0)
- return (res);
- y0++;
- }
- }
-
- return 0;
-}
-#endif
-
/*
* Place cursor at (x,y), and clear the next "n" chars
*/
}
/*
- * Add a keypress to the "queue"
- */
-errr term_keypress(int k)
-{
- /* Refuse to enqueue non-keys */
- if (!k)
- return -1;
-
- /* Store the char, advance the queue */
- Term->key_queue[Term->key_head++] = (char)k;
-
- /* Circular queue, handle wrap */
- if (Term->key_head == Term->key_size)
- Term->key_head = 0;
-
- if (Term->key_head != Term->key_tail)
- return 0;
-
- return 1;
-}
-
-/*
* Add a keypress to the FRONT of the "queue"
*/
errr term_key_push(int k)
* To "create" a valid "term", one should do "term_init(t)", then
* set the various flags and hooks, and then do "term_activate(t)".
*/
-errr term_activate(term *t)
+errr term_activate(term_type *t)
{
/* already done */
if (Term == t)
}
/*
- * Nuke a term
- */
-errr term_nuke(term *t)
-{
- TERM_LEN w = t->wid;
- TERM_LEN h = t->hgt;
-
- /* Call the special "nuke" hook */
- if (t->active_flag) {
- /* Call the "nuke" hook */
- if (t->nuke_hook)
- (*t->nuke_hook)(t);
-
- /* Remember */
- t->active_flag = FALSE;
-
- /* Assume not mapped */
- t->mapped_flag = FALSE;
- }
-
- /* Nuke "displayed" */
- term_win_nuke(t->old, w, h);
-
- /* Kill "displayed" */
- KILL(t->old, term_win);
-
- /* Nuke "requested" */
- term_win_nuke(t->scr, w, h);
-
- /* Kill "requested" */
- KILL(t->scr, term_win);
-
- /* If needed */
- if (t->mem) {
- /* Nuke "memorized" */
- term_win_nuke(t->mem, w, h);
-
- /* Kill "memorized" */
- KILL(t->mem, term_win);
- }
-
- /* If needed */
- if (t->tmp) {
- /* Nuke "temporary" */
- term_win_nuke(t->tmp, w, h);
-
- /* Kill "temporary" */
- KILL(t->tmp, term_win);
- }
-
- /* Free some arrays */
- C_KILL(t->x1, h, TERM_LEN);
- C_KILL(t->x2, h, TERM_LEN);
-
- /* Free the input queue */
- C_KILL(t->key_queue, t->key_size, char);
- return 0;
-}
-
-/*
* Initialize a term, using a window of the given size.
* Also prepare the "input queue" for "k" keypresses
* By default, the cursor starts out "invisible"
* By default, we "erase" using "black spaces"
*/
-errr term_init(term *t, TERM_LEN w, TERM_LEN h, int k)
+errr term_init(term_type *t, TERM_LEN w, TERM_LEN h, int k)
{
/* Wipe it */
- (void)WIPE(t, term);
+ (void)WIPE(t, term_type);
/* Prepare the input queue */
t->key_head = t->key_tail = 0;
/*!
* @brief term実装構造体 / An actual "term" structure
*/
-typedef struct term {
+typedef struct term_type term_type;
+typedef struct term_type {
vptr user; //!< Extra "user" info (used by application)
vptr data; //!< Extra "data" info (used by implementation)
term_win *tmp; //!< Temporary screen image
term_win *mem; //!< Memorized screen image
- void (*init_hook)(term *t); //!< Hook for init - ing the term
- void (*nuke_hook)(term *t); //!< Hook for nuke - ing the term
+ void (*init_hook)(term_type *t); //!< Hook for init - ing the term
+ void (*nuke_hook)(term_type *t); //!< Hook for nuke - ing the term
errr (*user_hook)(int n); //!< ユーザ設定項目実装部 / Hook for user actions
errr (*xtra_hook)(int n, int v); //!< 拡張機能実装部 / Hook for extra actions
errr (*text_hook)(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, concptr s); //!< テキスト描画実装部 / Hook for drawing a string of chars using an attr
void (*resize_hook)(void); //!< 画面リサイズ実装部
errr (*pict_hook)(TERM_LEN x, TERM_LEN y, int n, const TERM_COLOR *ap, concptr cp, const TERM_COLOR *tap, concptr tcp); //!< タイル描画実装部 / Hook for drawing a sequence of special attr / char pairs
-} term;
+} term_type;
/**** Available Constants ****/
#define TERM_XTRA_MUSIC_MUTE 18
/**** Available Variables ****/
-extern term *Term;
+extern term_type *Term;
/**** Available Functions ****/
extern errr term_user(int n);
extern void term_queue_line(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR *a, char *c, TERM_COLOR *ta, char *tc);
-extern void term_queue_chars(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, concptr s);
-
extern errr term_fresh(void);
extern errr term_set_cursor(int v);
extern errr term_gotoxy(TERM_LEN x, TERM_LEN y);
extern errr term_addstr(int n, TERM_COLOR a, concptr s);
extern errr term_putch(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c);
extern errr term_putstr(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, concptr s);
-#ifdef JP
-extern errr term_putstr_v(TERM_LEN x, TERM_LEN y, int n, byte a, concptr s);
-#endif
extern errr term_erase(TERM_LEN x, TERM_LEN y, int n);
extern errr term_clear(void);
extern errr term_redraw(void);
extern errr term_what(TERM_LEN x, TERM_LEN y, TERM_COLOR *a, char *c);
extern errr term_flush(void);
-extern errr term_keypress(int k);
extern errr term_key_push(int k);
extern errr term_inkey(char *ch, bool wait, bool take);
extern errr term_resize(TERM_LEN w, TERM_LEN h);
-extern errr term_activate(term *t);
+extern errr term_activate(term_type *t);
-extern errr term_nuke(term *t);
-extern errr term_init(term *t, TERM_LEN w, TERM_LEN h, int k);
+extern errr term_init(term_type *t, TERM_LEN w, TERM_LEN h, int k);
#endif
void fix_spell(player_type *player_ptr)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
void fix_inventory(player_type *player_ptr, tval_type item_tester_tval)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
void fix_monster_list(player_type *player_ptr)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
if (!(window_flag[j] & (PW_MONSTER_LIST)))
void fix_equip(player_type *player_ptr, tval_type item_tester_tval)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
if (!(window_flag[j] & (PW_EQUIP)))
void fix_player(player_type *player_ptr)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
void fix_message(void)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
void fix_overhead(player_type *player_ptr)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
TERM_LEN wid, hgt;
if (!angband_term[j])
continue;
void fix_dungeon(player_type *player_ptr)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
void fix_monster(player_type *player_ptr)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;
void fix_object(player_type *player_ptr)
{
for (int j = 0; j < 8; j++) {
- term *old = Term;
+ term_type *old = Term;
if (!angband_term[j])
continue;