-/* File: z-term.h */
+/* File: z-term.h */
/*
* Copyright (c) 1997 Ben Harrison
#include "h-basic.h"
-
-/*
- * A term_win is a "window" for a Term
- *
- * - Cursor Useless/Visible codes
- * - Cursor Location (see "Useless")
- *
- * - Array[h] -- Access to the attribute array
- * - Array[h] -- Access to the character array
- *
- * - Array[h*w] -- Attribute array
- * - Array[h*w] -- Character array
- *
- * Note that the attr/char pair at (x,y) is a[y][x]/c[y][x]
- * and that the row of attr/chars at (0,y) is a[y]/c[y]
- */
-
typedef struct term_win term_win;
-
-struct term_win
+ /*!
+ * @brief A term_win is a "window" for a Term
+ */
+ struct term_win
{
- bool cu, cv;
- byte cx, cy;
+ bool cu, cv; //!< Cursor Useless / Visible codes
+ TERM_LEN cx, cy; //!< Cursor Location (see "Useless")
- byte **a;
- char **c;
+ TERM_COLOR **a; //!< Array[h*w] -- Attribute array
+ char **c; //!< Array[h*w] -- Character array
- byte *va;
- char *vc;
+ TERM_COLOR *va; //!< Array[h] -- Access to the attribute array
+ char *vc; //!< Array[h] -- Access to the character array
- byte **ta;
- char **tc;
+ TERM_COLOR **ta; //!< Note that the attr pair at(x, y) is a[y][x]
+ char **tc; //!< Note that the char pair at(x, y) is c[y][x]
- byte *vta;
- char *vtc;
+ TERM_COLOR *vta; //!< Note that the row of attr at(0, y) is a[y]
+ char *vtc; //!< Note that the row of chars at(0, y) is c[y]
};
-/*
- * An actual "term" structure
- *
- * - Extra "user" info (used by application)
- *
- * - Extra "data" info (used by implementation)
- *
- *
- * - Flag "user_flag"
- * An extra "user" flag (used by application)
- *
- *
- * - Flag "data_flag"
- * An extra "data" flag (used by implementation)
- *
- *
- * - Flag "active_flag"
- * This "term" is "active"
- *
- * - Flag "mapped_flag"
- * This "term" is "mapped"
- *
- * - Flag "total_erase"
- * This "term" should be fully erased
- *
- * - Flag "fixed_shape"
- * This "term" is not allowed to resize
- *
- * - Flag "icky_corner"
- * This "term" has an "icky" corner grid
- *
- * - Flag "soft_cursor"
- * This "term" uses a "software" cursor
- *
- * - Flag "always_pict"
- * Use the "Term_pict()" routine for all text
- *
- * - Flag "higher_pict"
- * Use the "Term_pict()" routine for special text
- *
- * - Flag "always_text"
- * Use the "Term_text()" routine for invisible text
- *
- * - Flag "unused_flag"
- * Reserved for future use
- *
- * - Flag "never_bored"
- * Never call the "TERM_XTRA_BORED" action
- *
- * - Flag "never_frosh"
- * Never call the "TERM_XTRA_FROSH" action
- *
- *
- * - Value "attr_blank"
- * Use this "attr" value for "blank" grids
- *
- * - Value "char_blank"
- * Use this "char" value for "blank" grids
- *
- *
- * - Ignore this pointer
- *
- * - Keypress Queue -- various data
- *
- * - Keypress Queue -- pending keys
- *
- *
- * - Window Width (max 255)
- * - Window Height (max 255)
- *
- * - Minimum modified row
- * - Maximum modified row
- *
- * - Minimum modified column (per row)
- * - Maximum modified column (per row)
- *
- *
- * - Displayed screen image
- * - Requested screen image
- *
- * - Temporary screen image
- * - Memorized screen image
- *
- *
- * - Hook for init-ing the term
- * - Hook for nuke-ing the term
- *
- * - Hook for user actions
- *
- * - Hook for extra actions
- *
- * - Hook for placing the cursor
- *
- * - Hook for drawing some blank spaces
- *
- * - Hook for drawing a string of chars using an attr
- *
- * - Hook for drawing a sequence of special attr/char pairs
+/*!
+ * @brief term実装構造体 / An actual "term" structure
*/
-
typedef struct term term;
-
struct term
{
- vptr user;
-
- vptr data;
-
- bool user_flag;
-
- bool data_flag;
-
- bool active_flag;
- bool mapped_flag;
- bool total_erase;
- bool fixed_shape;
- bool icky_corner;
- bool soft_cursor;
- bool always_pict;
- bool higher_pict;
- bool always_text;
- bool unused_flag;
- bool never_bored;
- bool never_frosh;
-
- byte attr_blank;
- char char_blank;
-
- char *key_queue;
-
+ vptr user; //!< Extra "user" info (used by application)
+ vptr data; //!< Extra "data" info (used by implementation)
+
+ bool user_flag; //!< Flag "user_flag" An extra "user" flag (used by application)
+ bool data_flag; //!< Flag "data_flag" An extra "data" flag (used by implementation)
+
+ bool active_flag; //!< Flag "active_flag" This "term" is "active"
+ bool mapped_flag; //!< Flag "mapped_flag" This "term" is "mapped"
+ bool total_erase; //!< Flag "total_erase" This "term" should be fully erased
+ bool fixed_shape; //!< Flag "fixed_shape" This "term" is not allowed to resize
+ bool icky_corner; //!< Flag "icky_corner" This "term" has an "icky" corner grid
+ bool soft_cursor; //!< Flag "soft_cursor" This "term" uses a "software" cursor
+ bool always_pict; //!< Flag "always_pict" Use the "Term_pict()" routine for all text
+ bool higher_pict; //!< Flag "higher_pict" Use the "Term_pict()" routine for special text
+ bool always_text; //!< Flag "always_text" Use the "Term_text()" routine for invisible text
+ bool unused_flag; //!< Flag "unused_flag" Reserved for future use
+ bool never_bored; //!< Flag "never_bored" Never call the "TERM_XTRA_BORED" action
+ bool never_frosh; //!< Flag "never_frosh" Never call the "TERM_XTRA_FROSH" action
+
+ byte attr_blank; //!< Value "attr_blank" Use this "attr" value for "blank" grids
+ char char_blank; //!< Value "char_blank" Use this "char" value for "blank" grids
+
+ char *key_queue; //!< Keypress Queue -- various data / Keypress Queue -- pending keys
u16b key_head;
u16b key_tail;
u16b key_xtra;
u16b key_size;
- byte wid;
- byte hgt;
+ TERM_LEN wid; //!< Window Width(max 255)
+ TERM_LEN hgt; //!< Window Height(max 255)
- byte y1;
- byte y2;
+ TERM_LEN y1; //!< Minimum modified row
+ TERM_LEN y2; //!< Maximum modified row
- byte *x1;
- byte *x2;
+ TERM_LEN *x1; //!< Minimum modified column(per row)
+ TERM_LEN *x2; //!< Maximum modified column(per row)
- term_win *old;
- term_win *scr;
+ term_win *old; //!< Displayed screen image
+ term_win *scr; //!< Requested screen image
- term_win *tmp;
- term_win *mem;
+ term_win *tmp; //!< Temporary screen image
+ term_win *mem; //!< Memorized screen image
- void (*init_hook)(term *t);
- void (*nuke_hook)(term *t);
+ void (*init_hook)(term *t); //!< Hook for init - ing the term
+ void (*nuke_hook)(term *t); //!< Hook for nuke - ing the term
- errr (*user_hook)(int n);
-
- errr (*xtra_hook)(int n, int v);
-
- errr (*curs_hook)(int x, int y);
-
- errr (*bigcurs_hook)(int x, int y);
-
- errr (*wipe_hook)(int x, int y, int n);
-
- errr (*text_hook)(int x, int y, int n, byte a, cptr s);
-
- void (*resize_hook)(void);
-
- errr (*pict_hook)(int x, int y, int n, const byte *ap, const char *cp, const byte *tap, const char *tcp);
+ errr (*user_hook)(int n); //!< ユーザ設定項目実装部 / Hook for user actions
+ errr (*xtra_hook)(int n, int v); //!< 拡張機能実装部 / Hook for extra actions
+ errr (*curs_hook)(TERM_LEN x, TERM_LEN y); //!< カーソル描画実装部 / Hook for placing the cursor
+ errr (*bigcurs_hook)(TERM_LEN x, TERM_LEN y); //!< 大型タイル時カーソル描画実装部 / Hook for placing the cursor on bigtile mode
+ errr (*wipe_hook)(TERM_LEN x, TERM_LEN y, int n); //!< 指定座標テキスト消去実装部 / Hook for drawing some blank spaces
+ 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, TERM_COLOR *ap, concptr cp, const TERM_COLOR *tap, concptr tcp); //!< タイル描画実装部 / Hook for drawing a sequence of special attr / char pairs
};
#define TERM_XTRA_MUSIC_DUNGEON 15 /* Play a music(dungeon) (optional) */
#define TERM_XTRA_MUSIC_QUEST 16 /* Play a music(quest) (optional) */
#define TERM_XTRA_MUSIC_TOWN 17 /* Play a music(floor) (optional) */
-
+#define TERM_XTRA_MUSIC_MUTE 18
/**** Available Variables ****/
extern errr Term_user(int n);
extern errr Term_xtra(int n, int v);
-extern void Term_queue_char(int x, int y, byte a, char c, byte ta, char tc);
-extern void Term_queue_bigchar(int x, int y, byte a, char c, byte ta, char tc);
+extern void Term_queue_char(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc);
+extern void Term_queue_bigchar(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc);
-extern void Term_queue_line(int x, int y, int n, byte *a, char *c, byte *ta, char *tc);
+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(int x, int y, int n, byte a, cptr s);
+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(int x, int y);
-extern errr Term_draw(int x, int y, byte a, char c);
-extern errr Term_addch(byte a, char c);
-extern errr Term_add_bigch(byte a, char c);
-extern errr Term_addstr(int n, byte a, cptr s);
-extern errr Term_putch(int x, int y, byte a, char c);
-extern errr Term_putstr(int x, int y, int n, byte a, cptr s);
+extern errr Term_gotoxy(TERM_LEN x, TERM_LEN y);
+extern errr Term_draw(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c);
+extern errr Term_addch(TERM_COLOR a, char c);
+extern errr Term_add_bigch(TERM_COLOR a, char c);
+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(int x, int y, int n, byte a, cptr s);
+extern errr Term_putstr_v(TERM_LEN x, TERM_LEN y, int n, byte a, concptr s);
#endif
-extern errr Term_erase(int x, int y, int n);
+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_redraw_section(int x1, int y1, int x2, int y2);
+extern errr Term_redraw_section(TERM_LEN x1, TERM_LEN y1, TERM_LEN x2, TERM_LEN y2);
extern errr Term_get_cursor(int *v);
-extern errr Term_get_size(int *w, int *h);
+extern errr Term_get_size(TERM_LEN *w, TERM_LEN *h);
extern errr Term_locate(int *x, int *y);
-extern errr Term_what(int x, int y, byte *a, char *c);
+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);