diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-03-03 20:59:35 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-03-29 20:57:25 +0200 |
commit | 1d054725dd5165d349f5c8fd425e6161bf67c6f5 (patch) | |
tree | f663a2c46c02a4093b44823736f65201f550cfb3 /src/z-term.c | |
parent | c033064404865fd1cccad23e36ce195fca92c64d (diff) |
Refactor: USE_TRANSPARENCY compile-time flag always set
Diffstat (limited to 'src/z-term.c')
-rw-r--r-- | src/z-term.c | 171 |
1 files changed, 0 insertions, 171 deletions
diff --git a/src/z-term.c b/src/z-term.c index ef4dfeaa..4e89ffb7 100644 --- a/src/z-term.c +++ b/src/z-term.c @@ -300,8 +300,6 @@ static errr term_win_nuke(term_win *s, int w, int h) C_KILL(s->va, h * w, byte); C_KILL(s->vc, h * w, char); -#ifdef USE_TRANSPARENCY - /* Free the terrain access arrays */ C_KILL(s->ta, h, byte*); C_KILL(s->tc, h, char*); @@ -318,8 +316,6 @@ static errr term_win_nuke(term_win *s, int w, int h) C_KILL(s->vea, h * w, byte); C_KILL(s->vec, h * w, char); -#endif /* USE_TRANSPARENCY */ - /* Success */ return (0); } @@ -340,8 +336,6 @@ static errr term_win_init(term_win *s, int w, int h) C_MAKE(s->va, h * w, byte); C_MAKE(s->vc, h * w, char); -#ifdef USE_TRANSPARENCY - /* Make the terrain access arrays */ C_MAKE(s->ta, h, byte*); C_MAKE(s->tc, h, char*); @@ -358,8 +352,6 @@ static errr term_win_init(term_win *s, int w, int h) C_MAKE(s->vea, h * w, byte); C_MAKE(s->vec, h * w, char); -#endif /* USE_TRANSPARENCY */ - /* Prepare the window access arrays */ for (y = 0; y < h; y++) @@ -367,16 +359,12 @@ static errr term_win_init(term_win *s, int w, int h) s->a[y] = s->va + w * y; s->c[y] = s->vc + w * y; -#ifdef USE_TRANSPARENCY - s->ta[y] = s->vta + w * y; s->tc[y] = s->vtc + w * y; s->ea[y] = s->vea + w * y; s->ec[y] = s->vec + w * y; -#endif /* USE_TRANSPARENCY */ - } /* Success */ @@ -400,8 +388,6 @@ static errr term_win_copy(term_win *s, term_win *f, int w, int h) byte *s_aa = s->a[y]; char *s_cc = s->c[y]; -#ifdef USE_TRANSPARENCY - byte *f_taa = f->ta[y]; char *f_tcc = f->tc[y]; @@ -414,21 +400,16 @@ static errr term_win_copy(term_win *s, term_win *f, int w, int h) byte *s_eaa = s->ea[y]; char *s_ecc = s->ec[y]; -#endif /* USE_TRANSPARENCY */ - for (x = 0; x < w; x++) { *s_aa++ = *f_aa++; *s_cc++ = *f_cc++; -#ifdef USE_TRANSPARENCY *s_taa++ = *f_taa++; *s_tcc++ = *f_tcc++; *s_eaa++ = *f_eaa++; *s_ecc++ = *f_ecc++; -#endif /* USE_TRANSPARENCY */ - } } @@ -520,18 +501,10 @@ static errr Term_text_hack(int x, int y, int n, byte a, const char *cp) /* * Hack -- fake hook for "Term_pict()" (see above) */ -#ifdef USE_TRANSPARENCY static errr Term_pict_hack(int x, int y, int n, const byte *ap, const char *cp, const byte *tap, const char *tcp, const byte *eap, const char *ecp) -#else /* USE_TRANSPARENCY */ -static errr Term_pict_hack(int x, int y, int n, const byte *ap, const char *cp) -#endif /* USE_TRANSPARENCY */ { /* Compiler silliness */ -#ifdef USE_TRANSPARENCY if (x || y || n || ap || cp || tap || tcp || eap || ecp) return ( -2); -#else /* USE_TRANSPARENCY */ - if (x || y || n || ap || cp) return ( -2); -#endif /* USE_TRANSPARENCY */ /* Oops */ return ( -1); @@ -547,19 +520,13 @@ static errr Term_pict_hack(int x, int y, int n, const byte *ap, const char *cp) * * Assumes given location and values are valid. */ -#ifdef USE_TRANSPARENCY void Term_queue_char(int x, int y, byte a, char c, byte ta, char tc, byte ea, char ec) -#else /* USE_TRANSPARENCY */ -void Term_queue_char(int x, int y, byte a, char c) -#endif /* USE_TRANSPARENCY */ { term_win *scrn = Term->scr; byte *scr_aa = &scrn->a[y][x]; char *scr_cc = &scrn->c[y][x]; -#ifdef USE_TRANSPARENCY - byte *scr_taa = &scrn->ta[y][x]; char *scr_tcc = &scrn->tc[y][x]; @@ -571,27 +538,16 @@ void Term_queue_char(int x, int y, byte a, char c) (*scr_taa == ta) && (*scr_tcc == tc) && (*scr_eaa == ea) && (*scr_ecc == ec)) return; -#else /* USE_TRANSPARENCY */ - - /* Hack -- Ignore non-changes */ - if ((*scr_aa == a) && (*scr_cc == c)) return; - -#endif /* USE_TRANSPARENCY */ - /* Save the "literal" information */ *scr_aa = a; *scr_cc = c; -#ifdef USE_TRANSPARENCY - *scr_taa = ta; *scr_tcc = tc; *scr_eaa = ea; *scr_ecc = ec; -#endif /* USE_TRANSPARENCY */ - /* Check for new min/max row info */ if (y < Term->y1) Term->y1 = y; if (y > Term->y2) Term->y2 = y; @@ -610,11 +566,7 @@ void Term_queue_char(int x, int y, byte a, char c) * This function is designed to be fast, with no consistancy checking. * It is used to update the map in the game. */ -#ifdef USE_TRANSPARENCY void Term_queue_line(int x, int y, int n, byte *a, char *c, byte *ta, char *tc, byte *ea, char *ec) -#else /* USE_TRANSPARENCY */ -void Term_queue_line(int x, int y, int n, byte *a, char *c) -#endif /* USE_TRANSPARENCY */ { term_win *scrn = Term->scr; @@ -624,21 +576,15 @@ void Term_queue_line(int x, int y, int n, byte *a, char *c) byte *scr_aa = &scrn->a[y][x]; char *scr_cc = &scrn->c[y][x]; -#ifdef USE_TRANSPARENCY - byte *scr_taa = &scrn->ta[y][x]; char *scr_tcc = &scrn->tc[y][x]; byte *scr_eaa = &scrn->ea[y][x]; char *scr_ecc = &scrn->ec[y][x]; -#endif /* USE_TRANSPARENCY */ - while (n--) { -#ifdef USE_TRANSPARENCY - /* Hack -- Ignore non-changes */ if ((*scr_aa == *a) && (*scr_cc == *c) && (*scr_taa == *ta) && (*scr_tcc == *tc) && @@ -668,21 +614,6 @@ void Term_queue_line(int x, int y, int n, byte *a, char *c) *scr_eaa++ = *ea++; *scr_ecc++ = *ec++; -#else /* USE_TRANSPARENCY */ - - /* Hack -- Ignore non-changes */ - if ((*scr_aa == *a) && (*scr_cc == *c)) - { - x++; - a++; - c++; - scr_aa++; - scr_cc++; - continue; - } - -#endif /* USE_TRANSPARENCY */ - /* Save the "literal" information */ *scr_aa++ = *a++; *scr_cc++ = *c++; @@ -726,24 +657,18 @@ void Term_queue_chars(int x, int y, int n, byte a, cptr s) byte *scr_aa = Term->scr->a[y]; char *scr_cc = Term->scr->c[y]; -#ifdef USE_TRANSPARENCY - byte *scr_taa = Term->scr->ta[y]; char *scr_tcc = Term->scr->tc[y]; byte *scr_eaa = Term->scr->ea[y]; char *scr_ecc = Term->scr->ec[y]; -#endif /* USE_TRANSPARENCY */ - /* Queue the attr/chars */ for ( ; n; x++, s++, n--) { int oa = scr_aa[x]; int oc = scr_cc[x]; -#ifdef USE_TRANSPARENCY - int ota = scr_taa[x]; int otc = scr_tcc[x]; @@ -755,27 +680,17 @@ void Term_queue_chars(int x, int y, int n, byte a, cptr s) (ota == 0) && (otc == 0) && (oea == 0) && (oec == 0)) continue; -#else /* USE_TRANSPARENCY */ - - /* Hack -- Ignore non-changes */ - if ((oa == a) && (oc == *s)) continue; - -#endif /* USE_TRANSPARENCY */ /* Save the "literal" information */ scr_aa[x] = a; scr_cc[x] = *s; -#ifdef USE_TRANSPARENCY - scr_taa[x] = 0; scr_tcc[x] = 0; scr_taa[x] = 0; scr_tcc[x] = 0; -#endif /* USE_TRANSPARENCY */ - /* Note the "range" of window updates */ if (x1 < 0) x1 = x; x2 = x; @@ -814,8 +729,6 @@ static void Term_fresh_row_pict(int y, int x1, int x2) byte *scr_aa = Term->scr->a[y]; char *scr_cc = Term->scr->c[y]; -#ifdef USE_TRANSPARENCY - byte *old_taa = Term->old->ta[y]; char *old_tcc = Term->old->tc[y]; @@ -840,7 +753,6 @@ static void Term_fresh_row_pict(int y, int x1, int x2) byte nea; char nec; -#endif /* USE_TRANSPARENCY */ /* Pending length */ @@ -866,8 +778,6 @@ static void Term_fresh_row_pict(int y, int x1, int x2) na = scr_aa[x]; nc = scr_cc[x]; -#ifdef USE_TRANSPARENCY - ota = old_taa[x]; otc = old_tcc[x]; @@ -884,26 +794,15 @@ static void Term_fresh_row_pict(int y, int x1, int x2) if ((na == oa) && (nc == oc) && (nta == ota) && (ntc == otc) && (nea == oea) && (nec == oec)) - -#else /* USE_TRANSPARENCY */ - - /* Handle unchanged grids */ - if ((na == oa) && (nc == oc)) - -#endif /* USE_TRANSPARENCY */ { /* Flush */ if (fn) { /* Draw pending attr/char pairs */ -#ifdef USE_TRANSPARENCY (void)((*Term->pict_hook)(fx, y, fn, &scr_aa[fx], &scr_cc[fx], &scr_taa[fx], &scr_tcc[fx], &scr_eaa[fx], &scr_ecc[fx])); -#else /* USE_TRANSPARENCY */ - (void)((*Term->pict_hook)(fx, y, fn, &scr_aa[fx], &scr_cc[fx])); -#endif /* USE_TRANSPARENCY */ /* Forget */ fn = 0; @@ -916,13 +815,11 @@ static void Term_fresh_row_pict(int y, int x1, int x2) old_aa[x] = na; old_cc[x] = nc; -#ifdef USE_TRANSPARENCY old_taa[x] = nta; old_tcc[x] = ntc; old_eaa[x] = nea; old_ecc[x] = nec; -#endif /* USE_TRANSPARENCY */ /* Restart and Advance */ if (fn++ == 0) fx = x; @@ -932,14 +829,10 @@ static void Term_fresh_row_pict(int y, int x1, int x2) if (fn) { /* Draw pending attr/char pairs */ -#ifdef USE_TRANSPARENCY (void)((*Term->pict_hook)(fx, y, fn, &scr_aa[fx], &scr_cc[fx], &scr_taa[fx], &scr_tcc[fx], &scr_eaa[fx], &scr_ecc[fx])); -#else /* USE_TRANSPARENCY */ - (void)((*Term->pict_hook)(fx, y, fn, &scr_aa[fx], &scr_cc[fx])); -#endif /* USE_TRANSPARENCY */ } } @@ -961,7 +854,6 @@ static void Term_fresh_row_both(int y, int x1, int x2) byte *scr_aa = Term->scr->a[y]; char *scr_cc = Term->scr->c[y]; -#ifdef USE_TRANSPARENCY byte *old_taa = Term->old->ta[y]; char *old_tcc = Term->old->tc[y]; byte *scr_taa = Term->scr->ta[y]; @@ -981,7 +873,6 @@ static void Term_fresh_row_both(int y, int x1, int x2) char oec; byte nea; char nec; -#endif /* USE_TRANSPARENCY */ /* The "always_text" flag */ int always_text = Term->always_text; @@ -1012,8 +903,6 @@ static void Term_fresh_row_both(int y, int x1, int x2) na = scr_aa[x]; nc = scr_cc[x]; -#ifdef USE_TRANSPARENCY - ota = old_taa[x]; otc = old_tcc[x]; @@ -1030,14 +919,6 @@ static void Term_fresh_row_both(int y, int x1, int x2) if ((na == oa) && (nc == oc) && (nta == ota) && (ntc == otc) && (nea == oea) && (nec == oec)) - -#else /* USE_TRANSPARENCY */ - - /* Handle unchanged grids */ - if ((na == oa) && (nc == oc)) - -#endif /* USE_TRANSPARENCY */ - { /* Flush */ if (fn) @@ -1064,16 +945,12 @@ static void Term_fresh_row_both(int y, int x1, int x2) old_aa[x] = na; old_cc[x] = nc; -#ifdef USE_TRANSPARENCY - old_taa[x] = nta; old_tcc[x] = ntc; old_eaa[x] = nea; old_ecc[x] = nec; -#endif /* USE_TRANSPARENCY */ - /* 2nd byte of bigtile */ if (na == 255) continue; @@ -1097,18 +974,9 @@ static void Term_fresh_row_both(int y, int x1, int x2) fn = 0; } -#ifdef USE_TRANSPARENCY - /* Hack -- Draw the special attr/char pair */ (void)((*Term->pict_hook)(x, y, 1, &na, &nc, &nta, &ntc, &nea, &nec)); -#else /* USE_TRANSPARENCY */ - - /* Hack -- Draw the special attr/char pair */ - (void)((*Term->pict_hook)(x, y, 1, &na, &nc)); - -#endif /* USE_TRANSPARENCY */ - /* Skip */ continue; } @@ -1461,16 +1329,12 @@ errr Term_fresh(void) byte *aa = old->a[y]; char *cc = old->c[y]; -#ifdef USE_TRANSPARENCY - byte *taa = old->ta[y]; char *tcc = old->tc[y]; byte *eaa = old->ea[y]; char *ecc = old->ec[y]; -#endif /* USE_TRANSPARENCY */ - /* Wipe each column */ for (x = 0; x < w; x++) @@ -1479,16 +1343,11 @@ errr Term_fresh(void) *aa++ = na; *cc++ = nc; -#ifdef USE_TRANSPARENCY - *taa++ = na; *tcc++ = nc; *eaa++ = na; *ecc++ = nc; - -#endif /* USE_TRANSPARENCY */ - } } @@ -1523,8 +1382,6 @@ errr Term_fresh(void) byte oa = old_aa[tx]; char oc = old_cc[tx]; -#ifdef USE_TRANSPARENCY - byte *old_taa = old->ta[ty]; char *old_tcc = old->tc[ty]; @@ -1537,26 +1394,16 @@ errr Term_fresh(void) byte oea = old_eaa[tx]; char oec = old_ecc[tx]; -#endif /* USE_TRANSPARENCY */ - /* Hack -- use "Term_pict()" always */ if (Term->always_pict) { -#ifdef USE_TRANSPARENCY (void)((*Term->pict_hook)(tx, ty, 1, &oa, &oc, &ota, &otc, &oea, &oec)); -#else /* USE_TRANSPARENCY */ - (void)((*Term->pict_hook)(tx, ty, 1, &oa, &oc)); -#endif /* USE_TRANSPARENCY */ } /* Hack -- use "Term_pict()" sometimes */ else if (Term->higher_pict && (oa & 0x80)) { -#ifdef USE_TRANSPARENCY (void)((*Term->pict_hook)(tx, ty, 1, &oa, &oc, &ota, &otc, &oea, &oec)); -#else /* USE_TRANSPARENCY */ - (void)((*Term->pict_hook)(tx, ty, 1, &oa, &oc)); -#endif /* USE_TRANSPARENCY */ } /* Hack -- restore the actual character */ @@ -1782,11 +1629,7 @@ errr Term_draw(int x, int y, byte a, char c) if (!c) return ( -2); /* Queue it for later */ -#ifdef USE_TRANSPARENCY Term_queue_char(x, y, a, c, 0, 0, 0, 0); -#else /* USE_TRANSPARENCY */ - Term_queue_char(x, y, a, c); -#endif /* USE_TRANSPARENCY */ /* Success */ return (0); @@ -1820,11 +1663,7 @@ errr Term_addch(byte a, char c) if (!c) return ( -2); /* Queue the given character for display */ -#ifdef USE_TRANSPARENCY Term_queue_char(Term->scr->cx, Term->scr->cy, a, c, 0, 0, 0, 0); -#else /* USE_TRANSPARENCY */ - Term_queue_char(Term->scr->cx, Term->scr->cy, a, c); -#endif /* USE_TRANSPARENCY */ /* Advance the cursor */ Term->scr->cx++; @@ -1949,13 +1788,11 @@ errr Term_erase(int x, int y, int n) byte *scr_aa; char *scr_cc; -#ifdef USE_TRANSPARENCY byte *scr_taa; char *scr_tcc; byte *scr_eaa; char *scr_ecc; -#endif /* USE_TRANSPARENCY */ /* Place cursor */ if (Term_gotoxy(x, y)) return ( -1); @@ -1967,13 +1804,11 @@ errr Term_erase(int x, int y, int n) scr_aa = Term->scr->a[y]; scr_cc = Term->scr->c[y]; -#ifdef USE_TRANSPARENCY scr_taa = Term->scr->ta[y]; scr_tcc = Term->scr->tc[y]; scr_eaa = Term->scr->ea[y]; scr_ecc = Term->scr->ec[y]; -#endif /* USE_TRANSPARENCY */ if (n > 0 && (byte)scr_cc[x] == 255 && scr_aa[x] == 255) { @@ -1994,13 +1829,11 @@ errr Term_erase(int x, int y, int n) scr_aa[x] = na; scr_cc[x] = nc; -#ifdef USE_TRANSPARENCY scr_taa[x] = 0; scr_tcc[x] = 0; scr_eaa[x] = 0; scr_ecc[x] = 0; -#endif /* USE_TRANSPARENCY */ /* Track minimum changed column */ if (x1 < 0) x1 = x; @@ -2053,13 +1886,11 @@ errr Term_clear(void) byte *scr_aa = Term->scr->a[y]; char *scr_cc = Term->scr->c[y]; -#ifdef USE_TRANSPARENCY byte *scr_taa = Term->scr->ta[y]; char *scr_tcc = Term->scr->tc[y]; byte *scr_eaa = Term->scr->ea[y]; char *scr_ecc = Term->scr->ec[y]; -#endif /* USE_TRANSPARENCY */ /* Wipe each column */ for (x = 0; x < w; x++) @@ -2067,13 +1898,11 @@ errr Term_clear(void) scr_aa[x] = na; scr_cc[x] = nc; -#ifdef USE_TRANSPARENCY scr_taa[x] = 0; scr_tcc[x] = 0; scr_eaa[x] = 0; scr_ecc[x] = 0; -#endif /* USE_TRANSPARENCY */ } /* This row has changed */ |