*/
#include "term/z-term.h"
+#include "game-option/map-screen-options.h"
#include "game-option/runtime-arguments.h"
#include "game-option/special-options.h"
+#include "term/gameterm.h"
#include "term/term-color-types.h"
#include "term/z-virt.h"
#endif
/* The current "term" */
-term *Term = NULL;
+term_type *Term = NULL;
/*** Local routines ***/
/*
* Nuke a term_win (see below)
*/
-static errr term_win_nuke(term_win *s, TERM_LEN w, TERM_LEN h)
+errr term_win_nuke(term_win *s, TERM_LEN w, TERM_LEN h)
{
/* Free the window access arrays */
C_KILL(s->a, h, TERM_COLOR *);
*/
void term_queue_bigchar(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc)
{
-
#ifdef JP
/*
* A table which relates each ascii character to a multibyte
* 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;
* (条件追加:タイルの1文字目でない事を確かめるように。)
*/
{
-
int w, h;
term_get_size(&w, &h);
if (x != w && !(scr_aa[x] & AF_TILE1) && (scr_aa[x] & AF_KANJI2)) {
}
}
+bool macro_running(void)
+{
+ int diff = angband_term[0]->key_head - angband_term[0]->key_tail;
+ return diff < -1 || 1 < diff;
+}
+
+bool need_term_fresh(void) { return !macro_running() || fresh_after; }
/*
* @brief Actually perform all requested changes to the window
*/
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
*/
/*
* Redraw part of a window.
*/
-static errr term_redraw_section(TERM_LEN x1, TERM_LEN y1, TERM_LEN x2, TERM_LEN y2)
+errr term_redraw_section(TERM_LEN x1, TERM_LEN y1, TERM_LEN x2, TERM_LEN y2)
{
char *g_ptr;
}
/*
- * 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)
/* Assume no key */
(*ch) = '\0';
-#ifdef CHUUKEI
- flush_ringbuf();
-#endif
-
/* get bored */
if (!Term->never_bored) {
/* Process random events */
/*
* Exchange the "requested" screen with the "tmp" screen
*/
-static errr term_exchange(void)
+errr term_exchange(void)
{
TERM_LEN w = Term->wid;
TERM_LEN h = Term->hgt;
* 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;
t->pict_hook = term_pict_hack;
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
+
+#ifndef WINDOWS
+errr term_nuke(term_type *t)
+{
+ TERM_LEN w = t->wid;
+ TERM_LEN h = t->hgt;
+ if (t->active_flag) {
+ if (t->nuke_hook)
+ (*t->nuke_hook)(t);
+
+ t->active_flag = FALSE;
+ t->mapped_flag = FALSE;
+ }
+
+ term_win_nuke(t->old, w, h);
+ KILL(t->old, term_win);
+ term_win_nuke(t->scr, w, h);
+ KILL(t->scr, term_win);
+ if (t->mem) {
+ term_win_nuke(t->mem, w, h);
+ KILL(t->mem, term_win);
+ }
+
+ if (t->tmp) {
+ term_win_nuke(t->tmp, w, h);
+ KILL(t->tmp, term_win);
+ }
+
+ C_KILL(t->x1, h, TERM_LEN);
+ C_KILL(t->x2, h, TERM_LEN);
+ C_KILL(t->key_queue, t->key_size, char);
+ return 0;
+}
+#endif
\ No newline at end of file