From dc28d9debbd3abb1da176bc6ab0ba596bcbda520 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 19 Jul 2011 08:42:58 +0200 Subject: CGE: rename constants in bitmap --- engines/cge/bitmap.cpp | 41 ++++++++++++++++++++--------------------- engines/cge/bitmap.h | 10 +++++----- engines/cge/jbw.h | 3 --- engines/cge/talk.cpp | 10 +++++----- engines/cge/vga13h.h | 1 + engines/cge/vmenu.cpp | 2 +- 6 files changed, 32 insertions(+), 35 deletions(-) (limited to 'engines') diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 29fc4fd8d6..9d898506da 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -38,7 +38,6 @@ namespace CGE { Dac *Bitmap::_pal = NULL; -#define MAXPATH 128 void Bitmap::init() { _pal = NULL; @@ -51,7 +50,7 @@ void Bitmap::deinit() { Bitmap::Bitmap(const char *fname, bool rem) : _m(NULL), _v(NULL), _map(0) { debugC(1, kDebugBitmap, "Bitmap::Bitmap(%s, %s)", fname, rem ? "true" : "false"); - char pat[MAXPATH]; + char pat[kMaxPath]; forceExt(pat, fname, ".VBM"); #if (BMP_MODE < 2) @@ -107,16 +106,16 @@ Bitmap::Bitmap(uint16 w, uint16 h, uint8 fill) if (v == NULL) error("No core"); - *(uint16 *) v = CPY | dsiz; // data chunk hader + *(uint16 *) v = kBmpCPY | dsiz; // data chunk hader memset(v + 2, fill, dsiz); // data bytes - *(uint16 *)(v + lsiz - 2) = SKP | ((SCR_WID / 4) - dsiz); // gap + *(uint16 *)(v + lsiz - 2) = kBmpSKP | ((SCR_WID / 4) - dsiz); // gap // Replicate lines byte *destP; for (destP = v + lsiz; destP < (v + psiz); destP += lsiz) Common::copy(v, v + lsiz, destP); - *(uint16 *)(v + psiz - 2) = EOI; // plane trailer uint16 + *(uint16 *)(v + psiz - 2) = kBmpEOI; // plane trailer uint16 // Repliccate planes for (destP = v + psiz; destP < (v + 4 * psiz); destP += psiz) @@ -224,7 +223,7 @@ BMP_PTR Bitmap::code() { } for (bpl = 0; bpl < 4; bpl++) { // once per each bitplane uint8 *bm = _m; - bool skip = (bm[bpl] == TRANS); + bool skip = (bm[bpl] == kPixelTransp); uint16 j; cnt = 0; @@ -232,21 +231,21 @@ BMP_PTR Bitmap::code() { uint8 pix; for (j = bpl; j < _w; j += 4) { pix = bm[j]; - if (_v && pix != TRANS) { + if (_v && pix != kPixelTransp) { if (j < _b[i]._skip) _b[i]._skip = j; if (j >= _b[i]._hide) _b[i]._hide = j + 1; } - if ((pix == TRANS) != skip || cnt >= 0x3FF0) { // end of block - cnt |= (skip) ? SKP : CPY; + if ((pix == kPixelTransp) != skip || cnt >= 0x3FF0) { // end of block + cnt |= (skip) ? kBmpSKP : kBmpCPY; if (_v) *cp = cnt; // store block description uint16 cp = (uint16 *) im; im += 2; - skip = (pix == TRANS); + skip = (pix == kPixelTransp); cnt = 0; } if (! skip) { @@ -262,7 +261,7 @@ BMP_PTR Bitmap::code() { if (skip) { cnt += (SCR_WID - j + 3) / 4; } else { - cnt |= CPY; + cnt |= kBmpCPY; if (_v) *cp = cnt; @@ -274,7 +273,7 @@ BMP_PTR Bitmap::code() { } } if (cnt && ! skip) { - cnt |= CPY; + cnt |= kBmpCPY; if (_v) *cp = cnt; @@ -282,7 +281,7 @@ BMP_PTR Bitmap::code() { im += 2; } if (_v) - *cp = EOI; + *cp = kBmpEOI; cp = (uint16 *) im; im += 2; } @@ -336,12 +335,12 @@ bool Bitmap::solidAt(int16 x, int16 y) { w &= 0x3FFF; switch (t) { - case EOI : + case kBmpEOI: r--; - case SKP : + case kBmpSKP: w = 0; break; - case REP : + case kBmpREP: w = 1; break; } @@ -361,18 +360,18 @@ bool Bitmap::solidAt(int16 x, int16 y) { n += w; switch (t) { - case EOI : + case kBmpEOI: return false; - case SKP : + case kBmpSKP: w = 0; break; - case REP : - case CPY : + case kBmpREP: + case kBmpCPY: if (n - w <= n0 && n > n0) return true; break; } - m += ((t == REP) ? 1 : w); + m += ((t == kBmpREP) ? 1 : w); } } diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h index 2728e27303..6b931573f8 100644 --- a/engines/cge/bitmap.h +++ b/engines/cge/bitmap.h @@ -32,12 +32,12 @@ namespace CGE { -#define EOI 0x0000 -#define SKP 0x4000 -#define REP 0x8000 -#define CPY 0xC000 +#define kBmpEOI 0x0000 +#define kBmpSKP 0x4000 +#define kBmpREP 0x8000 +#define kBmpCPY 0xC000 -#define TRANS 0xFE +#define kMaxPath 128 #include "common/pack-start.h" diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h index d555c82c5a..4540c1d8e5 100644 --- a/engines/cge/jbw.h +++ b/engines/cge/jbw.h @@ -91,9 +91,6 @@ enum Keys { TwiceRight }; -//extern uint16 _stklen; -//extern uint16 _heaplen; - } // End of namespace CGE #endif diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp index c00e7f3a88..a164a69f99 100644 --- a/engines/cge/talk.cpp +++ b/engines/cge/talk.cpp @@ -210,10 +210,10 @@ Bitmap *Talk::box(uint16 w, uint16 h) { for (int i = 0; i < r; i++) { int j; for (j = 0; j < r - i; j++) { - p[j] = TRANS; - p[w - j - 1] = TRANS; - q[j] = TRANS; - q[w - j - 1] = TRANS; + p[j] = kPixelTransp; + p[w - j - 1] = kPixelTransp; + q[j] = kPixelTransp; + q[w - j - 1] = kPixelTransp; } p[j] = LGRAY; p[w - j - 1] = DGRAY; @@ -305,7 +305,7 @@ void InfoLine::update(const char *tx) { for (pDest = v + lsiz; pDest < (v + psiz); pDest += lsiz) { Common::copy(v, v + lsiz, pDest); } - *(uint16 *)(v + psiz - 2) = EOI; // plane trailer uint16 + *(uint16 *)(v + psiz - 2) = kBmpEOI; // plane trailer uint16 for (pDest = v + psiz; pDest < (v + 4 * psiz); pDest += psiz) { Common::copy(v, v + psiz, pDest); } diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index 26969e7031..13bfce4189 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -62,6 +62,7 @@ namespace CGE { #define DGRAY 225 /*219*/ #define GRAY 231 #define LGRAY 237 +#define kPixelTransp 0xFE #define NO_SEQ (-1) #define NO_PTR ((uint8)-1) diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index c65ec6957e..af3d5ff4f5 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -36,7 +36,7 @@ MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) { int i = (w += 2 * kMenuBarHM) * h; uint8 *p = (uint8 *) malloc(sizeof(uint8) * i); - memset(p + w, TRANS, i - 2 * w); + memset(p + w, kPixelTransp, i - 2 * w); memset(p, kMenuBarLT, w); memset(p + i - w, kMenuBarRB, w); uint8 *p1 = p; -- cgit v1.2.3