/*
* Nuke a term_win (see below)
*/
-static errr term_win_nuke(term_win *s, int w, int h)
+static errr term_win_nuke(term_win *s, TERM_LEN w, TERM_LEN h)
{
/* Free the window access arrays */
- C_KILL(s->a, h, byte*);
+ C_KILL(s->a, h, TERM_COLOR*);
C_KILL(s->c, h, char*);
/* Free the window content arrays */
- C_KILL(s->va, h * w, byte);
+ C_KILL(s->va, h * w, TERM_COLOR);
C_KILL(s->vc, h * w, char);
/* Free the terrain access arrays */
- C_KILL(s->ta, h, byte*);
+ C_KILL(s->ta, h, TERM_COLOR*);
C_KILL(s->tc, h, char*);
/* Free the terrain content arrays */
- C_KILL(s->vta, h * w, byte);
+ C_KILL(s->vta, h * w, TERM_COLOR);
C_KILL(s->vtc, h * w, char);
/* Success */
/*
* Initialize a "term_win" (using the given window size)
*/
-static errr term_win_init(term_win *s, int w, int h)
+static errr term_win_init(term_win *s, TERM_LEN w, TERM_LEN h)
{
TERM_LEN y;
/* Make the window access arrays */
- C_MAKE(s->a, h, byte*);
+ C_MAKE(s->a, h, TERM_COLOR*);
C_MAKE(s->c, h, char*);
/* Make the window content arrays */
- C_MAKE(s->va, h * w, byte);
+ C_MAKE(s->va, h * w, TERM_COLOR);
C_MAKE(s->vc, h * w, char);
/* Make the terrain access arrays */
- C_MAKE(s->ta, h, byte*);
+ C_MAKE(s->ta, h, TERM_COLOR*);
C_MAKE(s->tc, h, char*);
/* Make the terrain content arrays */
- C_MAKE(s->vta, h * w, byte);
+ C_MAKE(s->vta, h * w, TERM_COLOR);
C_MAKE(s->vtc, h * w, char);
/*
* Copy a "term_win" from another
*/
-static errr term_win_copy(term_win *s, term_win *f, int w, int h)
+static errr term_win_copy(term_win *s, term_win *f, TERM_LEN w, TERM_LEN h)
{
TERM_LEN x, y;
(void)x;
(void)y;
- /* Oops */
return (-1);
}
(void)y;
(void)n;
- /* Oops */
return (-1);
}
(void)a;
(void)cp;
- /* Oops */
return (-1);
}
(void)tap;
(void)tcp;
- /* Oops */
return (-1);
}
* On systems with a "soft" cursor, we must explicitly erase the cursor
* before flushing the output, if needed, to prevent a "jumpy" refresh.
* The actual method for this is horrible, but there is very little that
- * we can do to simplify it efficiently. XXX XXX XXX
+ * we can do to simplify it efficiently.
*
* On systems with a "hard" cursor, we will "hide" the cursor before
* flushing the output, if needed, to avoid a "flickery" refresh. It
int na = Term->attr_blank;
int nc = Term->char_blank;
- byte *scr_aa;
+ TERM_COLOR *scr_aa;
char *scr_cc;
- byte *scr_taa;
+ TERM_COLOR *scr_taa;
char *scr_tcc;
/* Place cursor */
{
TERM_LEN x, y;
- int w = Term->wid;
- int h = Term->hgt;
+ TERM_LEN w = Term->wid;
+ TERM_LEN h = Term->hgt;
- byte na = Term->attr_blank;
+ TERM_COLOR na = Term->attr_blank;
char nc = Term->char_blank;
/* Cursor usable */
/* Wipe each row */
for (y = 0; y < h; y++)
{
- byte *scr_aa = Term->scr->a[y];
+ TERM_COLOR *scr_aa = Term->scr->a[y];
char *scr_cc = Term->scr->c[y];
- byte *scr_taa = Term->scr->ta[y];
+ TERM_COLOR *scr_taa = Term->scr->ta[y];
char *scr_tcc = Term->scr->tc[y];
/* Wipe each column */
/*
* Extract the current cursor location
*/
-errr Term_locate(int *x, int *y)
+errr Term_locate(TERM_LEN *x, TERM_LEN *y)
{
/* Access the cursor */
(*x) = Term->scr->cx;
* Note that this refers to what will be on the window after the
* next call to "Term_fresh()". It may or may not already be there.
*/
-errr Term_what(TERM_LEN x, TERM_LEN y, byte *a, char *c)
+errr Term_what(TERM_LEN x, TERM_LEN y, TERM_COLOR *a, char *c)
{
- int w = Term->wid;
- int h = Term->hgt;
+ TERM_LEN w = Term->wid;
+ TERM_LEN h = Term->hgt;
/* Verify location */
if ((x < 0) || (x >= w)) return (-1);
/* Success (unless overflow) */
if (Term->key_head != Term->key_tail) return (0);
-#if 0
- /* Hack -- Forget the oldest key */
- if (++Term->key_tail == Term->key_size) Term->key_tail = 0;
-#endif
-
/* Problem */
return (1);
}
*/
errr Term_save(void)
{
- int w = Term->wid;
- int h = Term->hgt;
+ TERM_LEN w = Term->wid;
+ TERM_LEN h = Term->hgt;
/* Create */
if (!Term->mem)
{
TERM_LEN y;
- int w = Term->wid;
- int h = Term->hgt;
+ TERM_LEN w = Term->wid;
+ TERM_LEN h = Term->hgt;
/* Create */
if (!Term->mem)
{
TERM_LEN y;
- int w = Term->wid;
- int h = Term->hgt;
+ TERM_LEN w = Term->wid;
+ TERM_LEN h = Term->hgt;
term_win *exchanger;
/*
* React to a new physical window size.
*/
-errr Term_resize(int w, int h)
+errr Term_resize(TERM_LEN w, TERM_LEN h)
{
int i;
- int wid, hgt;
+ TERM_LEN wid, hgt;
- byte *hold_x1;
- byte *hold_x2;
+ TERM_LEN *hold_x1;
+ TERM_LEN *hold_x2;
term_win *hold_old;
term_win *hold_scr;
hold_tmp = Term->tmp;
/* Create new scanners */
- C_MAKE(Term->x1, h, byte);
- C_MAKE(Term->x2, h, byte);
+ C_MAKE(Term->x1, h, TERM_LEN);
+ C_MAKE(Term->x2, h, TERM_LEN);
/* Create new window */
MAKE(Term->old, term_win);
}
/* Free some arrays */
- C_KILL(hold_x1, Term->hgt, byte);
- C_KILL(hold_x2, Term->hgt, byte);
+ C_KILL(hold_x1, Term->hgt, TERM_LEN);
+ C_KILL(hold_x2, Term->hgt, TERM_LEN);
/* Nuke */
term_win_nuke(hold_old, Term->wid, Term->hgt);
}
/* Save new size */
- Term->wid = (byte_hack)w;
- Term->hgt = (byte_hack)h;
+ Term->wid = w;
+ Term->hgt = h;
/* Force "total erase" */
Term->total_erase = TRUE;
*/
errr term_nuke(term *t)
{
- int w = t->wid;
- int h = t->hgt;
+ TERM_LEN w = t->wid;
+ TERM_LEN h = t->hgt;
/* Hack -- Call the special "nuke" hook */
}
/* Free some arrays */
- C_KILL(t->x1, h, byte);
- C_KILL(t->x2, h, byte);
+ 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);
* By default, the cursor starts out "invisible"
* By default, we "erase" using "black spaces"
*/
-errr term_init(term *t, int w, int h, int k)
+errr term_init(term *t, TERM_LEN w, TERM_LEN h, int k)
{
TERM_LEN y;
/* Save the size */
- t->wid = (byte_hack)w;
- t->hgt = (byte_hack)h;
+ t->wid = w;
+ t->hgt = h;
/* Allocate change arrays */
- C_MAKE(t->x1, h, byte);
- C_MAKE(t->x2, h, byte);
+ C_MAKE(t->x1, h, TERM_LEN);
+ C_MAKE(t->x2, h, TERM_LEN);
/* Allocate "displayed" */