diff options
author | Strangerke | 2011-06-10 19:02:13 +0200 |
---|---|---|
committer | Strangerke | 2011-06-10 19:02:13 +0200 |
commit | 7d88b9e4cde321ec210c5da022046639a316179b (patch) | |
tree | 0b59d842ae4cba125934cadb94e28794c26817d9 /engines | |
parent | 68f7ff111536c2d7f5a8869252ba8ad31507a380 (diff) | |
download | scummvm-rg350-7d88b9e4cde321ec210c5da022046639a316179b.tar.gz scummvm-rg350-7d88b9e4cde321ec210c5da022046639a316179b.tar.bz2 scummvm-rg350-7d88b9e4cde321ec210c5da022046639a316179b.zip |
CGE: Suppress typedef for byte, word and dword.
Diffstat (limited to 'engines')
36 files changed, 462 insertions, 469 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index a9ded67e45..9845c4a2da 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -97,7 +97,7 @@ BITMAP::BITMAP (const char * fname, bool rem) -BITMAP::BITMAP (word w, word h, byte * map) +BITMAP::BITMAP (uint16 w, uint16 h, uint8 * map) : W(w), H(h), M(map), V(NULL) { if (map) Code(); @@ -110,23 +110,23 @@ BITMAP::BITMAP (word w, word h, byte * map) // immediately as VGA video chunks, in near memory as fast as possible, // especially for text line real time display -BITMAP::BITMAP (word w, word h, byte fill) -: W((w + 3) & ~3), // only full dwords allowed! +BITMAP::BITMAP (uint16 w, uint16 h, uint8 fill) +: W((w + 3) & ~3), // only full uint32 allowed! H(h), M(NULL) { - word dsiz = W >> 2; // data size (1 plane line size) - word lsiz = 2 + dsiz + 2; // word for line header, word for gap - word psiz = H * lsiz; // - last gape, but + plane trailer - byte * v = new byte[4 * psiz // the same for 4 planes + uint16 dsiz = W >> 2; // data size (1 plane line size) + uint16 lsiz = 2 + dsiz + 2; // uint16 for line header, uint16 for gap + uint16 psiz = H * lsiz; // - last gape, but + plane trailer + uint8 * v = new uint8[4 * psiz // the same for 4 planes + H * sizeof(*B)]; // + room for wash table if (v == NULL) DROP("No core", NULL); - * (word *) v = CPY | dsiz; // data chunk hader + * (uint16 *) v = CPY | dsiz; // data chunk hader memset(v+2, fill, dsiz); // data bytes - * (word *) (v + lsiz - 2) = SKP | ((SCR_WID / 4) - dsiz); // gap + * (uint16 *) (v + lsiz - 2) = SKP | ((SCR_WID / 4) - dsiz); // gap memcpy(v + lsiz, v, psiz - lsiz); // tricky replicate lines - * (word *) (v + psiz - 2) = EOI; // plane trailer word + * (uint16 *) (v + psiz - 2) = EOI; // plane trailer uint16 memcpy(v + psiz, v, 3 * psiz); // tricky replicate planes HideDesc * b = (HideDesc *) (v + 4 * psiz); b->skip = (SCR_WID - W) >> 2; @@ -147,12 +147,12 @@ BITMAP::BITMAP (const BITMAP& bmp) : W(bmp.W), H(bmp.H), M(NULL), V(NULL) { - byte * v0 = bmp.V; + uint8 * v0 = bmp.V; if (v0) { - word vsiz = FP_OFF(bmp.B) - FP_OFF(v0); - word siz = vsiz + H * sizeof(HideDesc); - byte * v1 = farnew(byte, siz); + uint16 vsiz = FP_OFF(bmp.B) - FP_OFF(v0); + uint16 siz = vsiz + H * sizeof(HideDesc); + uint8 * v1 = farnew(uint8, siz); if (v1 == NULL) DROP("No core", NULL); _fmemcpy(v1, v0, siz); B = (HideDesc *) ((V = v1) + vsiz); @@ -171,7 +171,7 @@ BITMAP::~BITMAP (void) } switch (MemType(V)) { - case NEAR_MEM : delete[] (byte *) V; break; + case NEAR_MEM : delete[] (uint8 *) V; break; case FAR_MEM : farfree(V); break; } } @@ -180,7 +180,7 @@ BITMAP::~BITMAP (void) BITMAP& BITMAP::operator = (const BITMAP& bmp) { - byte * v0 = bmp.V; + uint8 * v0 = bmp.V; W = bmp.W; H = bmp.H; M = NULL; @@ -188,9 +188,9 @@ BITMAP& BITMAP::operator = (const BITMAP& bmp) if (v0 == NULL) V = NULL; else { - word vsiz = FP_OFF(bmp.B) - FP_OFF(v0); - word siz = vsiz + H * sizeof(HideDesc); - byte * v1 = farnew(byte, siz); + uint16 vsiz = FP_OFF(bmp.B) - FP_OFF(v0); + uint16 siz = vsiz + H * sizeof(HideDesc); + uint8 * v1 = farnew(uint8, siz); if (v1 == NULL) DROP("No core", NULL); _fmemcpy(v1, v0, siz); B = (HideDesc *) ((V = v1) + vsiz); @@ -202,12 +202,12 @@ BITMAP& BITMAP::operator = (const BITMAP& bmp) -word BITMAP::MoveVmap (byte * buf) +uint16 BITMAP::MoveVmap (uint8 * buf) { if (V) { - word vsiz = FP_OFF(B) - FP_OFF(V); - word siz = vsiz + H * sizeof(HideDesc); + uint16 vsiz = FP_OFF(B) - FP_OFF(V); + uint16 siz = vsiz + H * sizeof(HideDesc); _fmemcpy(buf, V, siz); if (MemType(V) == FAR_MEM) farfree(V); B = (HideDesc *) ((V = buf) + vsiz); @@ -226,13 +226,13 @@ BMP_PTR BITMAP::Code (void) { if (M) { - word i, cnt; + uint16 i, cnt; if (V) // old X-map exists, so remove it { switch (MemType(V)) { - case NEAR_MEM : delete[] (byte *) V; break; + case NEAR_MEM : delete[] (uint8 *) V; break; case FAR_MEM : farfree(V); break; } V = NULL; @@ -240,8 +240,8 @@ BMP_PTR BITMAP::Code (void) while (true) // at most 2 times: for (V == NULL) & for allocated block; { - byte * im = V+2; - word * cp = (word *) V; + uint8 * im = V+2; + uint16 * cp = (uint16 *) V; int bpl; if (V) // 2nd pass - fill the hide table @@ -254,14 +254,14 @@ BMP_PTR BITMAP::Code (void) } for (bpl = 0; bpl < 4; bpl ++) // once per each bitplane { - byte * bm = M; + uint8 * bm = M; bool skip = (bm[bpl] == TRANS); - word j; + uint16 j; cnt = 0; for (i = 0; i < H; i ++) // once per each line { - byte pix; + uint8 pix; for (j = bpl; j < W; j += 4) { pix = bm[j]; @@ -275,9 +275,9 @@ BMP_PTR BITMAP::Code (void) cnt |= (skip) ? SKP : CPY; if (V) { - *cp = cnt; // store block description word + *cp = cnt; // store block description uint16 } - cp = (word *) im; + cp = (uint16 *) im; im += 2; skip = (pix == TRANS); cnt = 0; @@ -304,7 +304,7 @@ BMP_PTR BITMAP::Code (void) { *cp = cnt; } - cp = (word *) im; + cp = (uint16 *) im; im += 2; skip = true; cnt = (SCR_WID - j + 3) / 4; @@ -318,16 +318,16 @@ BMP_PTR BITMAP::Code (void) { *cp = cnt; } - cp = (word *) im; + cp = (uint16 *) im; im += 2; } if (V) *cp = EOI; - cp = (word *) im; + cp = (uint16 *) im; im += 2; } if (V) break; - word sizV = (word) (im - 2 - V); - V = farnew(byte, sizV + H * sizeof(*B)); + uint16 sizV = (uint16) (im - 2 - V); + V = farnew(uint8, sizV + H * sizeof(*B)); if (! V) { DROP("No core", NULL); @@ -344,8 +344,8 @@ BMP_PTR BITMAP::Code (void) } else { - word s = B[i].skip & ~3; - word h = (B[i].hide + 3) & ~3; + uint16 s = B[i].skip & ~3; + uint16 h = (B[i].hide + 3) & ~3; B[i].skip = (cnt + s) >> 2; B[i].hide = (h - s) >> 2; cnt = SCR_WID - h; @@ -362,8 +362,8 @@ BMP_PTR BITMAP::Code (void) bool BITMAP::SolidAt (int x, int y) { - byte * m; - word r, n, n0; + uint8 * m; + uint16 r, n, n0; if (x >= W || y >= H) return false; @@ -373,9 +373,9 @@ bool BITMAP::SolidAt (int x, int y) while (r) { - word w, t; + uint16 w, t; - w = * (word *) m; + w = * (uint16 *) m; m += 2; t = w & 0xC000; w &= 0x3FFF; @@ -391,9 +391,9 @@ bool BITMAP::SolidAt (int x, int y) while (true) { - word w, t; + uint16 w, t; - w = * (word *) m; + w = * (uint16 *) m; m += 2; t = w & 0xC000; w &= 0x3FFF; @@ -418,13 +418,13 @@ bool BITMAP::SolidAt (int x, int y) bool BITMAP::VBMSave (XFILE * f) { - word p = (Pal != NULL), - n = ((word) (((byte *)B) - V)) + H * sizeof(HideDesc); - if (f->Error == 0) f->Write((byte *)&p, sizeof(p)); - if (f->Error == 0) f->Write((byte *)&n, sizeof(n)); - if (f->Error == 0) f->Write((byte *)&W, sizeof(W)); - if (f->Error == 0) f->Write((byte *)&H, sizeof(H)); - if (f->Error == 0) if (p) f->Write((byte *)Pal, 256 * sizeof(DAC)); + uint16 p = (Pal != NULL), + n = ((uint16) (((uint8 *)B) - V)) + H * sizeof(HideDesc); + if (f->Error == 0) f->Write((uint8 *)&p, sizeof(p)); + if (f->Error == 0) f->Write((uint8 *)&n, sizeof(n)); + if (f->Error == 0) f->Write((uint8 *)&W, sizeof(W)); + if (f->Error == 0) f->Write((uint8 *)&H, sizeof(H)); + if (f->Error == 0) if (p) f->Write((uint8 *)Pal, 256 * sizeof(DAC)); if (f->Error == 0) f->Write(V, n); return (f->Error == 0); } @@ -435,20 +435,20 @@ bool BITMAP::VBMSave (XFILE * f) bool BITMAP::VBMLoad (XFILE * f) { - word p, n; - if (f->Error == 0) f->Read((byte *)&p, sizeof(p)); - if (f->Error == 0) f->Read((byte *)&n, sizeof(n)); - if (f->Error == 0) f->Read((byte *)&W, sizeof(W)); - if (f->Error == 0) f->Read((byte *)&H, sizeof(H)); + uint16 p, n; + if (f->Error == 0) f->Read((uint8 *)&p, sizeof(p)); + if (f->Error == 0) f->Read((uint8 *)&n, sizeof(n)); + if (f->Error == 0) f->Read((uint8 *)&W, sizeof(W)); + if (f->Error == 0) f->Read((uint8 *)&H, sizeof(H)); if (f->Error == 0) { if (p) { - if (Pal) f->Read((byte *)Pal, 256 * sizeof(DAC)); + if (Pal) f->Read((uint8 *)Pal, 256 * sizeof(DAC)); else f->Seek(f->Mark() + 256 * sizeof(DAC)); } } - if ((V = farnew(byte, n)) == NULL) return false; + if ((V = farnew(uint8, n)) == NULL) return false; if (f->Error == 0) f->Read(V, n); B = (HideDesc *) (V + n - H * sizeof(HideDesc)); return (f->Error == 0); diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h index de2214fd63..2ce849cc2b 100644 --- a/engines/cge/bitmap.h +++ b/engines/cge/bitmap.h @@ -38,17 +38,17 @@ #define TRANS 0xFE -typedef struct { word b : 2; - word B : 6; - word g : 2; - word G : 6; - word r : 2; - word R : 6; - word Z : 8; +typedef struct { uint16 b : 2; + uint16 B : 6; + uint16 g : 2; + uint16 G : 6; + uint16 r : 2; + uint16 R : 6; + uint16 Z : 8; } BGR4; -typedef struct { word skip; word hide; } HideDesc; +typedef struct { uint16 skip; uint16 hide; } HideDesc; @@ -59,11 +59,11 @@ class BITMAP bool VBMLoad (XFILE * f); public: static DAC * Pal; - word W, H; - byte * M, * V; HideDesc * B; + uint16 W, H; + uint8 * M, * V; HideDesc * B; BITMAP (const char * fname, bool rem = true); - BITMAP (word w, word h, byte * map); - BITMAP (word w, word h, byte fill); + BITMAP (uint16 w, uint16 h, uint8 * map); + BITMAP (uint16 w, uint16 h, uint8 fill); BITMAP (const BITMAP& bmp); ~BITMAP (void); BITMAP * FlipH (void); @@ -74,7 +74,7 @@ public: void XShow (int x, int y); bool SolidAt (int x, int y); bool VBMSave (XFILE * f); - word MoveVmap (byte * buf); + uint16 MoveVmap (uint8 * buf); }; diff --git a/engines/cge/bitmaps.cpp b/engines/cge/bitmaps.cpp index 4749430c5b..0cdae18cab 100644 --- a/engines/cge/bitmaps.cpp +++ b/engines/cge/bitmaps.cpp @@ -36,7 +36,7 @@ #define G GRAY, #define D DGRAY, -static byte MCDesign0[]= { W W W W W W _ +static uint8 MCDesign0[]= { W W W W W W _ W W W W W o _ W W W W o _ _ W W W W W _ _ @@ -46,11 +46,11 @@ static byte MCDesign0[]= { W W W W W W _ _ _ _ _ _ o o }; -static byte MCDesign1[]= { _ }; +static uint8 MCDesign1[]= { _ }; -static byte SLDesign[] = { G G G G G G G G G _ _ _ _ _ _ +static uint8 SLDesign[] = { G G G G G G G G G _ _ _ _ _ _ L G G G G G G G G D _ _ _ _ _ _ L G G G G G G G D _ _ _ _ _ _ _ L G G G G G G G D _ _ _ _ @@ -68,7 +68,7 @@ static byte SLDesign[] = { G G G G G G G G G _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ D }; -static byte SRDesign[] = { _ _ _ _ _ _ G G G G G G G G G +static uint8 SRDesign[] = { _ _ _ _ _ _ G G G G G G G G G _ _ _ _ _ L G G G G G G G G D _ _ _ _ _ L G G G G G G G D _ _ _ _ _ L G G G G G G G D _ _ @@ -86,7 +86,7 @@ static byte SRDesign[] = { _ _ _ _ _ _ G G G G G G G G G D _ _ _ _ _ _ _ _ _ _ _ _ _ _ }; -static byte MapBrick[] = { L L L L L L L G +static uint8 MapBrick[] = { L L L L L L L G L G G G G G G D L G G G G G G D G D D D D D D D @@ -110,7 +110,7 @@ static byte MapBrick[] = { L L L L L L L G #define D 219, #define E 231, -static byte PRDesign[] = { A E E E C C D A B +static uint8 PRDesign[] = { A E E E C C D A B C _ _ _ _ _ _ D A C _ _ _ _ _ _ D A C _ _ _ _ _ _ D A @@ -131,7 +131,7 @@ static byte PRDesign[] = { A E E E C C D A B #define E 231, #define F 237, -static byte PRDesign[] = { D D D D D D D D _ +static uint8 PRDesign[] = { D D D D D D D D _ D D D D D D D D _ D _ _ _ _ _ _ _ _ D _ _ _ _ _ _ _ _ @@ -159,7 +159,7 @@ static byte PRDesign[] = { D D D D D D D D _ #define A _ x _ x _ x _ x #define B A A A A A A A A -static byte HLDesign[] = { B B B B B }; +static uint8 HLDesign[] = { B B B B B }; #undef _ #undef x @@ -178,7 +178,7 @@ static byte HLDesign[] = { B B B B B }; #define D 226, #define E 255, -static byte LIDesign[][9] = { { A A A +static uint8 LIDesign[][9] = { { A A A A B A A A A }, @@ -206,7 +206,7 @@ static byte LIDesign[][9] = { { A A A #define G 0, //226, -static byte MEDesign[][9] = { { R R R R R R R R R }, // 0 +static uint8 MEDesign[][9] = { { R R R R R R R R R }, // 0 { R R R R R R R R G }, // 1 { R R R R R R R G G }, // 2 { R R R R R R G G G }, // 3 diff --git a/engines/cge/boot.h b/engines/cge/boot.h index 1715fd02ec..3a22e89661 100644 --- a/engines/cge/boot.h +++ b/engines/cge/boot.h @@ -40,36 +40,36 @@ #endif typedef struct { - byte Jmp[3]; // NEAR jump machine code + uint8 Jmp[3]; // NEAR jump machine code char OEM_ID[8]; // OEM name and version - word SectSize; // bytes per sector - byte ClustSize; // sectors per cluster - word ResSecs; // sectors before 1st FAT - byte FatCnt; // number of FATs - word RootSize; // root directory entries - word TotSecs; // total sectors on disk - byte Media; // media descriptor byte - word FatSize; // sectors per FAT - word TrkSecs; // sectors per track - word HeadCnt; // number of sufraces - word HidnSecs; // special hidden sectors - word _; // (unknown: reserved?) - dword lTotSecs; // total number of sectors - word DriveNum; // physical drive number - byte XSign; // extended boot signature - dword Serial; // volume serial number + uint16 SectSize; // bytes per sector + uint8 ClustSize; // sectors per cluster + uint16 ResSecs; // sectors before 1st FAT + uint8 FatCnt; // number of FATs + uint16 RootSize; // root directory entries + uint16 TotSecs; // total sectors on disk + uint8 Media; // media descriptor byte + uint16 FatSize; // sectors per FAT + uint16 TrkSecs; // sectors per track + uint16 HeadCnt; // number of sufraces + uint16 HidnSecs; // special hidden sectors + uint16 _; // (unknown: reserved?) + uint32 lTotSecs; // total number of sectors + uint16 DriveNum; // physical drive number + uint8 XSign; // extended boot signature + uint32 Serial; // volume serial number char Label[11]; // volume label char FileSysID[8]; // file system ID char Code[BOOTCODE_SIZ-8]; // 8 = length of following - dword Secret; // long secret number - byte BootCheck; // boot sector checksum - byte BootFlags; // secret flags - word BootSig; // boot signature 0xAA55 + uint32 Secret; // long secret number + uint8 BootCheck; // boot sector checksum + uint8 BootFlags; // secret flags + uint16 BootSig; // boot signature 0xAA55 } Boot; EC Boot * ReadBoot (int drive); -EC byte CheckBoot (Boot * boot); +EC uint8 CheckBoot (Boot * boot); EC bool WriteBoot (int drive, Boot * boot); diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp index 7d222d101d..efc922b232 100644 --- a/engines/cge/cfile.cpp +++ b/engines/cge/cfile.cpp @@ -48,7 +48,7 @@ IOBUF::IOBUF (IOMODE mode, CRYPT * crpt) Ptr(0), Lim(0) { - Buff = farnew(byte, IOBUF_SIZE); + Buff = farnew(uint8, IOBUF_SIZE); if (Buff == NULL) DROP("No core for I/O", NULL); } @@ -66,7 +66,7 @@ IOBUF::IOBUF (const char * name, IOMODE mode, CRYPT * crpt) Ptr(0), Lim(0) { - Buff = farnew(byte, IOBUF_SIZE); + Buff = farnew(uint8, IOBUF_SIZE); if (Buff == NULL) DROP("No core for I/O", name); } @@ -114,18 +114,18 @@ void IOBUF::WriteBuff (void) -word IOBUF::Read (void *buf, word len) +uint16 IOBUF::Read (void *buf, uint16 len) { - word total = 0; + uint16 total = 0; while (len) { if (Ptr >= Lim) ReadBuff(); - word n = Lim - Ptr; + uint16 n = Lim - Ptr; if (n) { if (len < n) n = len; _fmemcpy(buf, Buff+Ptr, n); - (byte *) buf += n; + (uint8 *) buf += n; len -= n; total += n; Ptr += n; @@ -140,25 +140,25 @@ word IOBUF::Read (void *buf, word len) -word IOBUF::Read (byte * buf) +uint16 IOBUF::Read (uint8 * buf) { - word total = 0; + uint16 total = 0; while (total < LINE_MAX-2) { if (Ptr >= Lim) ReadBuff(); - byte * p = Buff + Ptr; - word n = Lim - Ptr; + uint8 * p = Buff + Ptr; + uint16 n = Lim - Ptr; if (n) { if (total + n >= LINE_MAX-2) n = LINE_MAX-2 - total; - byte * eol = (byte *) _fmemchr(p, '\r', n); - if (eol) n = (word) (eol - p); - byte * eof = (byte *) _fmemchr(p, '\32', n); + uint8 * eol = (uint8 *) _fmemchr(p, '\r', n); + if (eol) n = (uint16) (eol - p); + uint8 * eof = (uint8 *) _fmemchr(p, '\32', n); if (eof) // end-of-file { - n = (word) (eof - p); - Ptr = (word) (eof - Buff); + n = (uint16) (eof - p); + Ptr = (uint16) (eof - Buff); } if (n) _fmemcpy(buf, p, n); buf += n; @@ -187,19 +187,19 @@ word IOBUF::Read (byte * buf) -word IOBUF::Write (void * buf, word len) +uint16 IOBUF::Write (void * buf, uint16 len) { - word tot = 0; + uint16 tot = 0; while (len) { - word n = IOBUF_SIZE - Lim; + uint16 n = IOBUF_SIZE - Lim; if (n > len) n = len; if (n) { _fmemcpy(Buff+Lim, buf, n); Lim += n; len -= n; - (byte *) buf += n; + (uint8 *) buf += n; tot += n; } else WriteBuff(); @@ -212,9 +212,9 @@ word IOBUF::Write (void * buf, word len) -word IOBUF::Write (byte * buf) +uint16 IOBUF::Write (uint8 * buf) { - word len = 0; + uint16 len = 0; if (buf) { len = _fstrlen((const char *) buf); @@ -223,7 +223,7 @@ word IOBUF::Write (byte * buf) if (len) { static char EOL[] = "\r\n"; - word n = Write(EOL, sizeof(EOL)-1); + uint16 n = Write(EOL, sizeof(EOL)-1); len += n; } } @@ -250,7 +250,7 @@ int IOBUF::Read (void) -void IOBUF::Write (byte b) +void IOBUF::Write (uint8 b) { if (Lim >= IOBUF_SIZE) { @@ -264,7 +264,7 @@ void IOBUF::Write (byte b) - word CFILE::MaxLineLen = LINE_MAX; + uint16 CFILE::MaxLineLen = LINE_MAX; @@ -321,7 +321,7 @@ long CFILE::Seek (long pos) { if (pos >= BufMark && pos < BufMark + Lim) { - ((Mode == REA) ? Ptr : Lim) = (word) (pos - BufMark); + ((Mode == REA) ? Ptr : Lim) = (uint16) (pos - BufMark); return pos; } else diff --git a/engines/cge/cfile.h b/engines/cge/cfile.h index 5903d605ed..bbb45a9e85 100644 --- a/engines/cge/cfile.h +++ b/engines/cge/cfile.h @@ -38,7 +38,7 @@ #define IOBUF_SIZE K(2) #endif -#define CFREAD(x) Read((byte *)(x),sizeof(*(x))) +#define CFREAD(x) Read((uint8 *)(x),sizeof(*(x))) @@ -46,10 +46,10 @@ class IOBUF : public IOHAND { protected: - byte * Buff; - word Ptr, Lim; + uint8 * Buff; + uint16 Ptr, Lim; long BufMark; - word Seed; + uint16 Seed; CRYPT * Crypt; virtual void ReadBuff (void); virtual void WriteBuff (void); @@ -57,12 +57,12 @@ public: IOBUF (IOMODE mode, CRYPT * crpt = NULL); IOBUF (const char * name, IOMODE mode, CRYPT * crpt = NULL); virtual ~IOBUF (void); - word Read (void * buf, word len); - word Read (char * buf); + uint16 Read (void * buf, uint16 len); + uint16 Read (char * buf); int Read (void); - word Write (void * buf, word len); - word Write (byte * buf); - void Write (byte b); + uint16 Write (void * buf, uint16 len); + uint16 Write (uint8 * buf); + void Write (uint8 b); }; @@ -70,7 +70,7 @@ public: class CFILE : public IOBUF { public: - static word MaxLineLen; + static uint16 MaxLineLen; CFILE (const char * name, IOMODE mode = REA, CRYPT * crpt = NULL); virtual ~CFILE (void); void Flush (void); diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 1f621948c2..d8829247a4 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -74,7 +74,7 @@ #define SVG0FILE INI_FILE #endif -extern word _stklen = (STACK_SIZ * 2); +extern uint16 _stklen = (STACK_SIZ * 2); // 0.75 - 17II95 - full sound support // 0.76 - 18II95 - small MiniEMS in DEMO, @@ -137,14 +137,14 @@ static SPRITE * MiniCave = NULL; static SPRITE * Shadow = NULL; static VGA Vga = M13H; -static EMS * Mini = MiniEmm.Alloc((word)MINI_EMM_SIZE); +static EMS * Mini = MiniEmm.Alloc((uint16)MINI_EMM_SIZE); static BMP_PTR * MiniShpList = NULL; static BMP_PTR MiniShp[] = { NULL, NULL }; static KEYBOARD Keyboard; static bool Finis = false; static int Startup = 1; static int OffUseCount = atoi(Text[OFF_USE_COUNT]); - word *intStackPtr = false; + uint16 *intStackPtr = false; HXY HeroXY[CAVE_MAX] = {{0,0}}; @@ -168,11 +168,11 @@ void FeedSnail (SPRITE * spr, SNLIST snq); // defined in SNAIL -byte CLUSTER::Map[MAP_ZCNT][MAP_XCNT]; +uint8 CLUSTER::Map[MAP_ZCNT][MAP_XCNT]; -byte & CLUSTER::Cell (void) +uint8 & CLUSTER::Cell (void) { return Map[B][A]; } @@ -189,7 +189,7 @@ bool CLUSTER::Protected (void) if (A == Barriers[Now].Vert || B == Barriers[Now].Horz) return true; _DX = (MAP_ZCNT << 8) + MAP_XCNT; - _BX = (word) this; + _BX = (uint16) this; asm mov ax,1 asm mov cl,[bx].(COUPLE)A @@ -209,7 +209,7 @@ bool CLUSTER::Protected (void) asm xor ch,ch asm add ax,cx asm mov bx,ax - _BX += (word) Map; + _BX += (uint16) Map; //asm add bx,offset CLUSTER::Map asm mov al,[bx] asm and ax,0xFF @@ -252,8 +252,8 @@ CLUSTER XZ (COUPLE xy) int pocref[POCKET_NX]; - byte volume[2]; - struct SAVTAB { void * Ptr; int Len; byte Flg; } SavTab[] = + uint8 volume[2]; + struct SAVTAB { void * Ptr; int Len; uint8 Flg; } SavTab[] = {{ &Now, sizeof(Now), 1 }, { &OldLev, sizeof(OldLev), 1 }, { &DemoText, sizeof(DemoText), 1 }, @@ -285,10 +285,10 @@ static void LoadGame (XFILE& file, bool tiny = false) for (st = SavTab; st->Ptr; st ++) { if (file.Error) VGA::Exit("Bad SVG"); - file.Read((byte *) ((tiny || st->Flg) ? st->Ptr : &i), st->Len); + file.Read((uint8 *) ((tiny || st->Flg) ? st->Ptr : &i), st->Len); } - file.Read((byte *) &i, sizeof(i)); + file.Read((uint8 *) &i, sizeof(i)); if (i != SVGCHKSUM) VGA::Exit(BADSVG_TEXT); if (STARTUP::Core < CORE_HIG) Music = false; if (STARTUP::SoundOk == 1 && STARTUP::Mode == 0) @@ -303,7 +303,7 @@ static void LoadGame (XFILE& file, bool tiny = false) while (! file.Error) { SPRITE S(NULL); - word n = file.Read((byte *) &S, sizeof(S)); + uint16 n = file.Read((uint8 *) &S, sizeof(S)); if (n != sizeof(S)) break; S.Prev = S.Next = NULL; @@ -354,14 +354,14 @@ static void SaveGame (XFILE& file) for (st = SavTab; st->Ptr; st ++) { if (file.Error) VGA::Exit("Bad SVG"); - file.Write((byte *) st->Ptr, st->Len); + file.Write((uint8 *) st->Ptr, st->Len); } - file.Write((byte *) &(i = SVGCHKSUM), sizeof(i)); + file.Write((uint8 *) &(i = SVGCHKSUM), sizeof(i)); for (spr = VGA::SpareQ.First(); spr; spr = spr->Next) if (spr->Ref >= 1000) - if (!file.Error) file.Write((byte *)spr, sizeof(*spr)); + if (!file.Error) file.Write((uint8 *)spr, sizeof(*spr)); } @@ -435,7 +435,7 @@ static void LoadMapping (void) { memset(CLUSTER::Map, 0, sizeof(CLUSTER::Map)); cf.Seek((Now - 1) * sizeof(CLUSTER::Map)); - cf.Read((byte *) CLUSTER::Map, sizeof(CLUSTER::Map)); + cf.Read((uint8 *) CLUSTER::Map, sizeof(CLUSTER::Map)); } } } @@ -579,7 +579,7 @@ void WALK::Park (void) void WALK::FindWay (CLUSTER c) { bool Find1Way(void); - extern word Target; + extern uint16 Target; if (c != Here) { @@ -670,7 +670,7 @@ class SQUARE : public SPRITE { public: SQUARE (void); - void Touch (word mask, int x, int y); + void Touch (uint16 mask, int x, int y); }; @@ -692,7 +692,7 @@ SQUARE::SQUARE (void) -void SQUARE::Touch (word mask, int x, int y) +void SQUARE::Touch (uint16 mask, int x, int y) { SPRITE::Touch(mask, x, y); if (mask & L_UP) @@ -865,7 +865,7 @@ void SYSTEM::SetPal (void) void SYSTEM::FunTouch (void) { - word n = (PAIN) ? HEROFUN1 : HEROFUN0; + uint16 n = (PAIN) ? HEROFUN1 : HEROFUN0; if (Talk == NULL || n > FunDel) FunDel = n; } @@ -1038,7 +1038,7 @@ void SwitchCave (int cav) -void SYSTEM::Touch (word mask, int x, int y) +void SYSTEM::Touch (uint16 mask, int x, int y) { static int pp = 0; void SwitchCave (int cav); @@ -1426,7 +1426,7 @@ static void SaveMapping (void) if (! cf.Error) { cf.Seek((Now-1) * sizeof(CLUSTER::Map)); - cf.Write((byte *) CLUSTER::Map, sizeof(CLUSTER::Map)); + cf.Write((uint8 *) CLUSTER::Map, sizeof(CLUSTER::Map)); } } { @@ -1435,7 +1435,7 @@ static void SaveMapping (void) { HeroXY[Now-1].X = Hero->X; HeroXY[Now-1].Y = Hero->Y; - cf.Write((byte *) HeroXY, sizeof(HeroXY)); + cf.Write((uint8 *) HeroXY, sizeof(HeroXY)); } } } @@ -1490,8 +1490,8 @@ static void SayDebug (void) if (t1 - t >= 18) { - static dword old = 0L; - dword now = Vga.FrmCnt; + static uint32 old = 0L; + uint32 now = Vga.FrmCnt; dwtom(now - old, FRPS, 10, 4); old = now; t = t1; @@ -1503,7 +1503,7 @@ static void SayDebug (void) dwtom(farcoreleft(), FFRE, 10, 6); // sprite queue size - word n = 0; + uint16 n = 0; SPRITE * spr; for (spr = VGA::ShowQ.First(); spr; spr = spr->Next) { @@ -1517,7 +1517,7 @@ static void SayDebug (void) dwtom(Sprite->Z, SP_Z, 10, 3); dwtom(Sprite->W, SP_W, 10, 3); dwtom(Sprite->H, SP_H, 10, 3); - dwtom(*(word *) (&Sprite->Flags), SP_F, 16, 2); + dwtom(*(uint16 *) (&Sprite->Flags), SP_F, 16, 2); } } dwtom(n, SP_S, 10, 2); @@ -1544,7 +1544,7 @@ static void SwitchDebug (void) -static void OptionTouch (int opt, word mask) +static void OptionTouch (int opt, uint16 mask) { switch (opt) { @@ -1567,7 +1567,7 @@ static void OptionTouch (int opt, word mask) #pragma argsused -void SPRITE::Touch (word mask, int x, int y) +void SPRITE::Touch (uint16 mask, int x, int y) { SYSTEM::FunTouch(); if ((mask & ATTN) == 0) @@ -1678,7 +1678,7 @@ static void LoadSprite (const char *fname, int ref, int cav, int col = 0, int ro bool port = false; bool tran = false; int i, lcnt = 0; - word len; + uint16 len; MergeExt(line, fname, SPR_EXT); if (INI_FILE::Exist(line)) // sprite description file exist @@ -1910,7 +1910,7 @@ static void MainLoop (void) #ifdef DEMO #define TIM ((182L*6L) * 5L) - static dword tc = 0; + static uint32 tc = 0; if (TimerCount - tc >= TIM && Talk == NULL && Snail.Idle()) { if (Text[DemoText]) @@ -1998,7 +1998,7 @@ static void RunGame (void) if (Mini && INI_FILE::Exist("MINI.SPR")) { - byte * ptr = (byte *) &*Mini; + uint8 * ptr = (uint8 *) &*Mini; if (ptr != NULL) { LoadSprite("MINI", -1, 0, MINI_X, MINI_Y); @@ -2159,7 +2159,7 @@ bool ShowTitle (const char * name) STARTUP::Summa |= (0xC0 + (DriveCD(0) << 6)) & 0xFF; #else Boot * b = ReadBoot(getdisk()); - dword sn = (b->XSign == 0x29) ? b->Serial : b->lTotSecs; + uint32 sn = (b->XSign == 0x29) ? b->Serial : b->lTotSecs; free(b); sn -= ((IDENT *)Copr)->disk; STARTUP::Summa |= Lo(sn) | Hi(sn); @@ -2217,7 +2217,7 @@ bool ShowTitle (const char * name) void StkDump (void) { CFILE f("!STACK.DMP", BFW); - f.Write((byte *) (intStackPtr-STACK_SIZ/2), STACK_SIZ*2); + f.Write((uint8 *) (intStackPtr-STACK_SIZ/2), STACK_SIZ*2); } #endif */ @@ -2227,7 +2227,7 @@ void StkDump (void) void cge_main (void) { - word intStack[STACK_SIZ/2]; + uint16 intStack[STACK_SIZ/2]; intStackPtr = intStack; //Debug( memset((void *) (-K(2)), 0, K(1)); ) @@ -2240,7 +2240,7 @@ void cge_main (void) Debug( DebugLine.Flags.Hide = true; ) Debug( HorzLine.Flags.Hide = true; ) - srand((word) Timer()); + srand((uint16) Timer()); Sys = new SYSTEM; if (Music && STARTUP::SoundOk) LoadMIDI(0); diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h index 4f610897b1..c1155eb650 100644 --- a/engines/cge/cge_main.h +++ b/engines/cge/cge_main.h @@ -148,7 +148,7 @@ public: static void SetPal (void); static void FunTouch (void); SYSTEM (void) : SPRITE(NULL) { SetPal(); Tick(); } - void Touch (word mask, int x, int y); + void Touch (uint16 mask, int x, int y); void Tick (void); }; @@ -163,8 +163,8 @@ public: class CLUSTER : public COUPLE { public: - static byte Map[MAP_ZCNT][MAP_XCNT]; - byte &Cell (void); + static uint8 Map[MAP_ZCNT][MAP_XCNT]; + uint8 &Cell (void); CLUSTER (void) : COUPLE () { } CLUSTER (int a, int b) : COUPLE (a, b) { } bool Protected (void); diff --git a/engines/cge/game.cpp b/engines/cge/game.cpp index 620e988c36..cc80a8f7fa 100644 --- a/engines/cge/game.cpp +++ b/engines/cge/game.cpp @@ -34,17 +34,17 @@ -byte * Glass (DAC * pal, byte r, byte g, byte b) +uint8 * Glass (DAC * pal, uint8 r, uint8 g, uint8 b) { - byte * x = new byte[256]; + uint8 * x = new uint8[256]; if (x) { - word i; + uint16 i; for (i = 0; i < 256; i ++) { - x[i] = Closest(pal, MkDAC(((word)(pal[i].R) * r) / 255, - ((word)(pal[i].G) * g) / 255, - ((word)(pal[i].B) * b) / 255)); + x[i] = Closest(pal, MkDAC(((uint16)(pal[i].R) * r) / 255, + ((uint16)(pal[i].G) * g) / 255, + ((uint16)(pal[i].B) * b) / 255)); } } return x; @@ -54,13 +54,13 @@ byte * Glass (DAC * pal, byte r, byte g, byte b) -byte * Mark (DAC * pal) +uint8 * Mark (DAC * pal) { #define f(c) (c ^ 63) - byte * x = new byte[256]; + uint8 * x = new uint8[256]; if (x) { - word i; + uint16 i; for (i = 0; i < 256; i ++) { x[i] = Closest(pal, MkDAC(f(pal[i].R), diff --git a/engines/cge/game.h b/engines/cge/game.h index 7a5efd9844..cda24512e3 100644 --- a/engines/cge/game.h +++ b/engines/cge/game.h @@ -44,8 +44,8 @@ extern SPRITE * Sys; int Sinus (long x); -byte * Glass (DAC * pal, byte r, byte g, byte b); -byte * Mark (DAC * pal); +uint8 * Glass (DAC * pal, uint8 r, uint8 g, uint8 b); +uint8 * Mark (DAC * pal); diff --git a/engines/cge/general.h b/engines/cge/general.h index 03c34d7058..75f754d0a3 100644 --- a/engines/cge/general.h +++ b/engines/cge/general.h @@ -35,10 +35,10 @@ #define SCR_WID_ 320 #define SCR_HIG_ 200 -#define SCR_WID ((word)SCR_WID_) -#define SCR_HIG ((word)SCR_HIG_) +#define SCR_WID ((uint16)SCR_WID_) +#define SCR_HIG ((uint16)SCR_HIG_) #define SCR_SEG 0xA000 -#define SCR_ADR ((byte *) MK_FP(SCR_SEG, 0)) +#define SCR_ADR ((uint8 *) MK_FP(SCR_SEG, 0)) @@ -48,10 +48,10 @@ enum ALLOC_MODE { FIRST_FIT, BEST_FIT, LAST_FIT }; enum IOMODE { REA, WRI, UPD }; typedef struct { - byte R, G, B; + uint8 R, G, B; } DAC; -typedef word CRYPT (void *buf, word siz, word seed); +typedef uint16 CRYPT (void *buf, uint16 siz, uint16 seed); @@ -86,7 +86,7 @@ protected: static void interrupt (* OldTimer) (...); static void interrupt NewTimer (...); public: - ENGINE (word tdiv); + ENGINE (uint16 tdiv); ~ENGINE (void); }; @@ -111,7 +111,7 @@ class EMM public: EMM::EMM (long size = 0); EMM::~EMM (void); - EMS * Alloc (word siz); + EMS * Alloc (uint16 siz); void Release (void); }; @@ -124,12 +124,12 @@ class EMS friend EMM; EMM * Emm; long Ptr; - word Siz; + uint16 Siz; EMS * Nxt; public: EMS (void); void * operator & () const; - word Size (void); + uint16 Size (void); }; @@ -181,11 +181,11 @@ class XFILE { public: IOMODE Mode; - word Error; + uint16 Error; XFILE (void) : Mode(REA), Error(0) { } XFILE (IOMODE mode) : Mode(mode), Error(0) { } - virtual word Read (void * buf, word len) = 0; - virtual word Write (void * buf, word len) = 0; + virtual uint16 Read (void * buf, uint16 len) = 0; + virtual uint16 Write (void * buf, uint16 len) = 0; virtual long Mark (void) = 0; virtual long Size (void) = 0; virtual long Seek (long pos) = 0; @@ -196,9 +196,9 @@ public: template <class T> -inline word XRead (XFILE * xf, T * t) +inline uint16 XRead (XFILE * xf, T * t) { - return xf->Read((byte *) t, sizeof(*t)); + return xf->Read((uint8 *) t, sizeof(*t)); }; @@ -209,15 +209,15 @@ class IOHAND : public XFILE { protected: int Handle; - word Seed; + uint16 Seed; CRYPT * Crypt; public: IOHAND (const char * name, IOMODE mode = REA, CRYPT crypt = NULL); IOHAND (IOMODE mode = REA, CRYPT * crpt = NULL); virtual ~IOHAND (void); static bool Exist (const char * name); - word Read (void * buf, word len); - word Write (void * buf, word len); + uint16 Read (void * buf, uint16 len); + uint16 Write (void * buf, uint16 len); long Mark (void); long Size (void); long Seek (long pos); @@ -238,18 +238,18 @@ unsigned FastRand (void); unsigned FastRand (unsigned s); CPU Cpu (void); ALLOC_MODE SetAllocMode (ALLOC_MODE am); -word atow (const char * a); -word xtow (const char * x); -char * wtom (word val, char * str, int radix, int len); -char * dwtom (dword val, char * str, int radix, int len); +uint16 atow (const char * a); +uint16 xtow (const char * x); +char * wtom (uint16 val, char * str, int radix, int len); +char * dwtom (uint32 val, char * str, int radix, int len); char * DateTimeString (void); void StdLog (const char *msg, const char *nam = NULL); -void StdLog (const char *msg, word w); -void StdLog (const char *msg, dword d); +void StdLog (const char *msg, uint16 w); +void StdLog (const char *msg, uint32 d); int TakeEnum (const char ** tab, const char * txt); -word ChkSum (void *m, word n); +uint16 ChkSum (void *m, uint16 n); long Timer (void); -long TimerLimit (word t); +long TimerLimit (uint16 t); bool TimerLimitGone (long t); char * MergeExt (char * buf, const char * nam, const char * ext); char * ForceExt (char * buf, const char * nam, const char * ext); @@ -260,7 +260,7 @@ int DriveRemote (unsigned drv); int DriveCD (unsigned drv); bool IsVga (void); -EC void _fqsort (void *base, word nelem, word width, +EC void _fqsort (void *base, uint16 nelem, uint16 width, int (*fcmp)(const void*, const void*)); diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp index ad9f885bb9..623374fe7d 100644 --- a/engines/cge/gettext.cpp +++ b/engines/cge/gettext.cpp @@ -86,7 +86,7 @@ void GET_TEXT::Tick (void) -void GET_TEXT::Touch (word mask, int x, int y) +void GET_TEXT::Touch (uint16 mask, int x, int y) { static char ogon[] = "•œ¥£˜ ¡"; static char bezo[] = "ACELNOSXZ"; diff --git a/engines/cge/gettext.h b/engines/cge/gettext.h index 2fbd6f5da6..d08e09a5bb 100644 --- a/engines/cge/gettext.h +++ b/engines/cge/gettext.h @@ -45,15 +45,15 @@ class GET_TEXT : public TALK { char Buff[GTMAX+2], * Text; - word Size, Len; - word Cntr; + uint16 Size, Len; + uint16 Cntr; SPRITE * OldKeybClient; void (*Click)(void); public: static GET_TEXT * Ptr; GET_TEXT (const char * info, char * text, int size, void (*click)(void) = NULL); ~GET_TEXT (void); - void Touch (word mask, int x, int y); + void Touch (uint16 mask, int x, int y); void Tick (void); }; diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h index 22110bc832..8776004273 100644 --- a/engines/cge/jbw.h +++ b/engines/cge/jbw.h @@ -51,19 +51,12 @@ #define ArrayCount(a) (sizeof(a)/sizeof((a)[0])) #define MAX_TIMER 0x1800B0L -typedef unsigned char BYTE; -typedef unsigned int WORD; -typedef unsigned long DWORD; - -typedef unsigned char byte; -typedef unsigned int word; -typedef unsigned long dword; typedef void (_loadds MouseFunType)(void); #define Lo(d) (((int *) &d)[0]) #define Hi(d) (((int *) &d)[1]) -#define LoWord(d) ((word) Lo(d)) -#define HiWord(d) ((word) Hi(d)) +#define LoWord(d) ((uint16) Lo(d)) +#define HiWord(d) ((uint16) Hi(d)) #define K(n) (1024*(n)) #define MASK(n) ((1<<n)-1) @@ -137,8 +130,8 @@ struct KeyStatStruct #define TimerCount (* ((volatile long *) ((void _seg *) 0x40 + (void *) 0x6C))) #define KeyStat (* ((volatile struct KeyStatStruct *) ((void _seg *) 0x40 + (void *) 0x17))) -#define BreakFlag (* ((volatile byte *) ((void _seg *) 0x40 + (void *) 0x71))) -#define PostFlag (* ((volatile word *) ((void _seg *) 0x40 + (void *) 0x72))) +#define BreakFlag (* ((volatile uint8 *) ((void _seg *) 0x40 + (void *) 0x71))) +#define PostFlag (* ((volatile uint16 *) ((void _seg *) 0x40 + (void *) 0x72))) #define POST ((void (*)(void)) ((void _seg *) 0xF000 + (void *) 0xFFF0)) #define SLIF if (KeyStat.ScrollLock) @@ -166,8 +159,8 @@ struct KeyStatStruct #endif -extern word _stklen; -extern word _heaplen; +extern uint16 _stklen; +extern uint16 _heaplen; #endif diff --git a/engines/cge/keybd.cpp b/engines/cge/keybd.cpp index 63a37a348e..c644473c53 100644 --- a/engines/cge/keybd.cpp +++ b/engines/cge/keybd.cpp @@ -31,9 +31,9 @@ SPRITE * KEYBOARD::Client = NULL; -byte KEYBOARD::Key[0x60] = { 0 }; -word KEYBOARD::Current = 0; -word KEYBOARD::Code[0x60] = { 0,Esc,'1','2','3','4','5','6','7','8','9','0', +uint8 KEYBOARD::Key[0x60] = { 0 }; +uint16 KEYBOARD::Current = 0; +uint16 KEYBOARD::Code[0x60] = { 0,Esc,'1','2','3','4','5','6','7','8','9','0', '-','+',BSp,Tab,'Q','W','E','R','T','Y','U', 'I','O','P','[',']',Enter,0/*Ctrl*/,'A','S', 'D','F','G','H','J','K','L',';','\'','`', @@ -81,7 +81,7 @@ SPRITE * KEYBOARD::SetClient (SPRITE * spr) void interrupt KEYBOARD::NewKeyboard (...) { // table address - _SI = (word) Key; + _SI = (uint16) Key; // take keyboard code asm in al,60h @@ -107,14 +107,14 @@ void interrupt KEYBOARD::NewKeyboard (...) asm jz xit // released: exit // pressed: lock ASCII code - _SI = (word) Code; - asm add bx,bx // word size + _SI = (uint16) Code; + asm add bx,bx // uint16 size asm mov ax,[si+bx] asm or ax,ax asm jz xit // zero means NO KEY Current = _AX; - _SI = (word) Client; + _SI = (uint16) Client; asm or si,si asm jz xit // if (Client) ... //--- fill current event entry with mask, key code and sprite diff --git a/engines/cge/keybd.h b/engines/cge/keybd.h index 7aa93b232f..dfbd439805 100644 --- a/engines/cge/keybd.h +++ b/engines/cge/keybd.h @@ -43,12 +43,12 @@ class KEYBOARD { static void interrupt (* OldKeyboard) (...); static void interrupt NewKeyboard (...); - static word Code[0x60]; - static word Current; + static uint16 Code[0x60]; + static uint16 Current; static SPRITE * Client; public: - static byte Key[0x60]; - static word Last (void) { _AX = Current; Current = 0; return _AX; } + static uint8 Key[0x60]; + static uint16 Last (void) { _AX = Current; Current = 0; return _AX; } static SPRITE * SetClient (SPRITE * spr); KEYBOARD (void); ~KEYBOARD (void); diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index 56a8c5f335..25d6eed32a 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -107,12 +107,12 @@ MIXER::~MIXER (void) #pragma argsused -void MIXER::Touch (word mask, int x, int y) +void MIXER::Touch (uint16 mask, int x, int y) { SPRITE::Touch(mask, x, y); if (mask & L_UP) { - byte * vol = (&SNDDrvInfo.VOL2.D) + (x < W/2); + uint8 * vol = (&SNDDrvInfo.VOL2.D) + (x < W/2); if (y < MIX_BHIG) { if (*vol < 0xFF) *vol += 0x11; } else if (y >= H-MIX_BHIG) { if (*vol > 0x00) *vol -= 0x11; } Update(); diff --git a/engines/cge/mixer.h b/engines/cge/mixer.h index e2377ff781..c770f0a794 100644 --- a/engines/cge/mixer.h +++ b/engines/cge/mixer.h @@ -49,7 +49,7 @@ public: static bool Appear; MIXER (int x, int y); ~MIXER (void); - void Touch (word mask, int x, int y); + void Touch (uint16 mask, int x, int y); void Tick (void); }; diff --git a/engines/cge/mouse.cpp b/engines/cge/mouse.cpp index 5fdaf08995..3c17e3632c 100644 --- a/engines/cge/mouse.cpp +++ b/engines/cge/mouse.cpp @@ -33,11 +33,11 @@ EVENT Evt[EVT_MAX]; - word EvtHead = 0, EvtTail = 0; + uint16 EvtHead = 0, EvtTail = 0; //-------------------------------------------------------------------------- MOUSE_FUN * MOUSE::OldMouseFun = NULL; -word MOUSE::OldMouseMask = 0; +uint16 MOUSE::OldMouseMask = 0; @@ -151,7 +151,7 @@ void MOUSE::ClrEvt (SPRITE * spr) { if (spr) { - word e; + uint16 e; for (e = EvtTail; e != EvtHead; e = (e + 1) % EVT_MAX) if (Evt[e].Ptr == spr) Evt[e].Msk = 0; } diff --git a/engines/cge/mouse.h b/engines/cge/mouse.h index e30abcaa94..42a6bf6c21 100644 --- a/engines/cge/mouse.h +++ b/engines/cge/mouse.h @@ -45,12 +45,12 @@ extern TALK * Talk; -struct EVENT { word Msk; - word X, Y; +struct EVENT { uint16 Msk; + uint16 X, Y; SPRITE * Ptr; }; extern EVENT Evt[EVT_MAX]; -extern word EvtHead, EvtTail; +extern uint16 EvtHead, EvtTail; typedef void (MOUSE_FUN) (void); @@ -61,7 +61,7 @@ class MOUSE : public SPRITE { static MOUSE_FUN * OldMouseFun; static MOUSE_FUN NewMouseFun; - static word OldMouseMask; + static uint16 OldMouseMask; SPRITE * Hold; int hx, hy; //void SetFun (void); diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 06824c5b12..4c15dc6a0c 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -394,7 +394,7 @@ void FeedSnail (SPRITE * spr, SNLIST snq) { if (spr) if (spr->Active()) { - byte ptr = (snq == TAKE) ? spr->TakePtr : spr->NearPtr; + uint8 ptr = (snq == TAKE) ? spr->TakePtr : spr->NearPtr; if (ptr != NO_PTR) { @@ -425,7 +425,7 @@ void FeedSnail (SPRITE * spr, SNLIST snq) SPRITE * s = (c->Ref < 0) ? spr : Locate(c->Ref); if (s) { - byte * idx = (snq == TAKE) ? &s->TakePtr : &s->NearPtr; + uint8 * idx = (snq == TAKE) ? &s->TakePtr : &s->NearPtr; if (*idx != NO_PTR) { int v; @@ -818,7 +818,7 @@ void SNSetY0 (int cav, int y0) -void SNSetXY (SPRITE * spr, word xy) +void SNSetXY (SPRITE * spr, uint16 xy) { if (spr) { @@ -1130,7 +1130,7 @@ static void SNLight (bool in) static void SNBarrier (int cav, int bar, bool horz) { - ((byte *) (Barriers + ((cav > 0) ? cav : Now)))[horz] = bar; + ((uint8 *) (Barriers + ((cav > 0) ? cav : Now)))[horz] = bar; } @@ -1178,7 +1178,7 @@ void SNAIL::RunCom (void) if (! Busy) { Busy = true; - byte tmphea = Head; + uint8 tmphea = Head; while (Tail != tmphea) { COM * snc = &SNList[Tail]; diff --git a/engines/cge/snail.h b/engines/cge/snail.h index f7e19290e6..b3268341d8 100644 --- a/engines/cge/snail.h +++ b/engines/cge/snail.h @@ -46,14 +46,14 @@ -typedef struct { byte Horz, Vert; } BAR; +typedef struct { uint8 Horz, Vert; } BAR; struct SCB { - byte * Ptr; - word Siz; + uint8 * Ptr; + uint16 Siz; SCB * Nxt; }; @@ -82,9 +82,9 @@ enum SNLIST { NEAR, TAKE }; class SNAIL { struct COM { SNCOM Com; int Ref; int Val; void * Ptr; } * SNList; - byte Head, Tail; + uint8 Head, Tail; bool Turbo, Busy, TextDelay; - word Pause; + uint16 Pause; public: static char * ComTxt[]; bool TalkEnable; diff --git a/engines/cge/snddrv.h b/engines/cge/snddrv.h index a445465dc8..809f73c3a7 100644 --- a/engines/cge/snddrv.h +++ b/engines/cge/snddrv.h @@ -58,23 +58,23 @@ struct DRVINFO { DEV_TYPE DDEV; // digi device DEV_TYPE MDEV; // midi device - WORD DBASE; // digi base port - WORD DDMA; // digi dma no - WORD DIRQ; // digi irq no - WORD MBASE; // midi base port + uint16 DBASE; // digi base port + uint16 DDMA; // digi dma no + uint16 DIRQ; // digi irq no + uint16 MBASE; // midi base port union { struct { - WORD DR : 4; - WORD DL : 4; - WORD MR : 4; - WORD ML : 4; + uint16 DR : 4; + uint16 DL : 4; + uint16 MR : 4; + uint16 ML : 4; } VOL4; struct { - BYTE D; // digi volume - BYTE M; // midi volume + uint8 D; // digi volume + uint8 M; // midi volume } VOL2; }; }; @@ -82,9 +82,9 @@ struct DRVINFO // sample info struct SMPINFO { - BYTE * saddr; // address - WORD slen; // length - WORD span; // left/right pan (0-15) + uint8 * saddr; // address + uint16 slen; // length + uint16 span; // left/right pan (0-15) int sflag; // flag }; @@ -95,10 +95,10 @@ struct SMPINFO extern DRVINFO SNDDrvInfo; // midi player flag (1 means we are playing) -extern WORD MIDIPlayFlag; +extern uint16 MIDIPlayFlag; // midi song end flag (1 means we have crossed end mark) -extern WORD MIDIEndFlag; +extern uint16 MIDIEndFlag; // ****************************************************** // * Driver Code * @@ -119,7 +119,7 @@ EC void SNDDigiStart (SMPINFO *PSmpInfo); EC void SNDDigiStop (SMPINFO *PSmpInfo); // Start MIDI File -EC void SNDMIDIStart (BYTE *MIDFile); +EC void SNDMIDIStart (uint8 *MIDFile); // Stop MIDI File EC void SNDMIDIStop (void); diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index b3c13a0211..03ba231fec 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -91,7 +91,7 @@ void SOUND::Play (DATACK * wav, int pan, int cnt) { Stop(); smpinf.saddr = (char *) &*(wav->EAddr()); - smpinf.slen = (word)wav->Size(); + smpinf.slen = (uint16)wav->Size(); smpinf.span = pan; smpinf.sflag = cnt; SNDDigiStart(&smpinf); @@ -246,7 +246,7 @@ DATACK * FX::operator [] (int ref) //------------------------------------------------------------------------- -static byte * midi = NULL; +static uint8 * midi = NULL; @@ -274,8 +274,8 @@ void LoadMIDI (int ref) INI_FILE mid = fn; if (mid.Error == 0) { - word siz = (word) mid.Size(); - midi = new byte[siz]; + uint16 siz = (uint16) mid.Size(); + midi = new uint8[siz]; if (midi) { mid.Read(midi, siz); @@ -303,8 +303,8 @@ EC void * Patch (int pat) INI_FILE snd = fn; if (! snd.Error) { - word siz = (word) snd.Size(); - p = (byte *) farmalloc(siz); + uint16 siz = (uint16) snd.Size(); + p = (uint8 *) farmalloc(siz); if (p) { snd.Read(p, siz); diff --git a/engines/cge/startup.cpp b/engines/cge/startup.cpp index 5555c12b16..18fd06d1ec 100644 --- a/engines/cge/startup.cpp +++ b/engines/cge/startup.cpp @@ -54,7 +54,7 @@ static STARTUP StartUp; int STARTUP::Mode = 0; int STARTUP::Core; int STARTUP::SoundOk = 0; - word STARTUP::Summa; + uint16 STARTUP::Summa; @@ -75,7 +75,7 @@ bool STARTUP::get_parms (void) static char *PrmTab[] = { "NEW", "MK0SVG", "QUIET", "SB", "GUS", "MIDI", "P", "D", "I", "M" }; int n = TakeEnum(PrmTab, strtok(_argv[--i], " =:(")); - word p = xtow(strtok(NULL, " h,)")); + uint16 p = xtow(strtok(NULL, " h,)")); switch (n) { case 0 : if (Mode != 2) Mode = 1; break; @@ -99,7 +99,7 @@ bool STARTUP::get_parms (void) #else #ifdef EVA { - union { dosdate_t d; dword n; } today; + union { dosdate_t d; uint32 n; } today; _dos_getdate(&today.d); id.disk += (id.disk < today.n); } @@ -120,7 +120,7 @@ bool STARTUP::get_parms (void) STARTUP::STARTUP (void) { - dword m = farcoreleft() >> 10; + uint32 m = farcoreleft() >> 10; if (m < 0x7FFF) Core = (int) m; else Core = 0x7FFF; if (! IsVga()) quit_now(NOT_VGA_TEXT); diff --git a/engines/cge/startup.h b/engines/cge/startup.h index 27507a7122..1c946508b5 100644 --- a/engines/cge/startup.h +++ b/engines/cge/startup.h @@ -64,7 +64,7 @@ public: static int Mode; static int Core; static int SoundOk; - static word Summa; + static uint16 Summa; STARTUP (void); }; diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp index d941dba274..822bc18de3 100644 --- a/engines/cge/talk.cpp +++ b/engines/cge/talk.cpp @@ -43,9 +43,9 @@ -//byte FONT::Wid[WID_SIZ]; -//word FONT::Pos[POS_SIZ]; -//byte FONT::Map[MAP_SIZ]; +//uint8 FONT::Wid[WID_SIZ]; +//uint16 FONT::Pos[POS_SIZ]; +//uint8 FONT::Map[MAP_SIZ]; @@ -55,9 +55,9 @@ FONT::FONT (const char * name) { - Map = farnew(byte, MAP_SIZ); - Pos = farnew(word, POS_SIZ); - Wid = farnew(byte, WID_SIZ); + Map = farnew(uint8, MAP_SIZ); + Pos = farnew(uint16, POS_SIZ); + Wid = farnew(uint8, WID_SIZ); if (Map == NULL || Pos == NULL || Wid == NULL) DROP("No core", NULL); MergeExt(Path, name, FONT_EXT); Load(); @@ -84,7 +84,7 @@ void FONT::Load (void) f.Read(Wid, WID_SIZ); if (! f.Error) { - word i, p = 0; + uint16 i, p = 0; for (i = 0; i < POS_SIZ; i ++) { Pos[i] = p; @@ -99,9 +99,9 @@ void FONT::Load (void) -word FONT::Width (const char * text) +uint16 FONT::Width (const char * text) { - word w = 0; + uint16 w = 0; if (text) while (* text) w += Wid[*(text ++)]; return w; } @@ -160,7 +160,7 @@ TALK::TALK (void) /* TALK::~TALK (void) { - word i; + uint16 i; for (i = 0; i < ShpCnt; i ++) { if (FP_SEG(ShpList[i]) != _DS) // small model: always false @@ -176,15 +176,15 @@ TALK::~TALK (void) void TALK::Update (const char * tx) { - word vmarg = (Mode) ? TEXT_VM : 0; - word hmarg = (Mode) ? TEXT_HM : 0; - word mw, mh, ln = vmarg; + uint16 vmarg = (Mode) ? TEXT_VM : 0; + uint16 hmarg = (Mode) ? TEXT_HM : 0; + uint16 mw, mh, ln = vmarg; const char * p; - byte * m; + uint8 * m; if (! TS[0]) { - word k = 2 * hmarg; + uint16 k = 2 * hmarg; mh = 2 * vmarg + FONT_HIG; mw = 0; for (p = tx; *p; p ++) @@ -214,8 +214,8 @@ void TALK::Update (const char * tx) for (i = 0; i < cw; i ++) { char * p = m; - word n; - register word b = * (f ++); + uint16 n; + register uint16 b = * (f ++); for (n = 0; n < FONT_HIG; n ++) { if (b & 1) * p = TEXT_FG; @@ -234,15 +234,15 @@ void TALK::Update (const char * tx) -BITMAP * TALK::Box (word w, word h) +BITMAP * TALK::Box (uint16 w, uint16 h) { - byte * b, * p, * q; - word n, r = (Mode == ROUND) ? TEXT_RD : 0; + uint8 * b, * p, * q; + uint16 n, r = (Mode == ROUND) ? TEXT_RD : 0; int i; if (w < 8) w = 8; if (h < 8) h = 8; - b = farnew(byte, n = w * h); + b = farnew(uint8, n = w * h); if (! b) VGA::Exit("No core"); _fmemset(b, TEXT_BG, n); @@ -286,13 +286,13 @@ BITMAP * TALK::Box (word w, word h) void TALK::PutLine (int line, const char * text) // Note: (TS[0].W % 4) have to be 0 { - word w = TS[0]->W, h = TS[0]->H; - byte * v = TS[0]->V, * p; - word dsiz = w >> 2; // data size (1 plane line size) - word lsiz = 2 + dsiz + 2; // word for line header, word for gap - word psiz = h * lsiz; // - last gap, but + plane trailer - word size = 4 * psiz; // whole map size - word rsiz = FONT_HIG * lsiz; // length of whole text row map + uint16 w = TS[0]->W, h = TS[0]->H; + uint8 * v = TS[0]->V, * p; + uint16 dsiz = w >> 2; // data size (1 plane line size) + uint16 lsiz = 2 + dsiz + 2; // uint16 for line header, uint16 for gap + uint16 psiz = h * lsiz; // - last gap, but + plane trailer + uint16 size = 4 * psiz; // whole map size + uint16 rsiz = FONT_HIG * lsiz; // length of whole text row map // set desired line pointer v += (TEXT_VM + (FONT_HIG + TEXT_LS) * line) * lsiz; @@ -307,19 +307,19 @@ void TALK::PutLine (int line, const char * text) // paint text line if (text) { - byte * q; + uint8 * q; p = v + 2 + TEXT_HM/4 + (TEXT_HM%4)*psiz; q = v + size; while (* text) { - word cw = Font.Wid[*text], i; - byte * fp = Font.Map + Font.Pos[*text]; + uint16 cw = Font.Wid[*text], i; + uint8 * fp = Font.Map + Font.Pos[*text]; for (i = 0; i < cw; i ++) { - register word b = fp[i]; - word n; + register uint16 b = fp[i]; + uint16 n; for (n = 0; n < FONT_HIG; n ++) { if (b & 1) *p = TEXT_FG; @@ -344,7 +344,7 @@ void TALK::PutLine (int line, const char * text) -INFO_LINE::INFO_LINE (word w) +INFO_LINE::INFO_LINE (uint16 w) : OldTxt(NULL) { TS[0] = new BITMAP(w, FONT_HIG, TEXT_BG); @@ -360,33 +360,33 @@ void INFO_LINE::Update (const char * tx) { if (tx != OldTxt) { - word w = TS[0]->W, h = TS[0]->H; - byte * v = (byte *) TS[0]->V; - word dsiz = w >> 2; // data size (1 plane line size) - word lsiz = 2 + dsiz + 2; // word for line header, word for gap - word psiz = h * lsiz; // - last gape, but + plane trailer - word size = 4 * psiz; // whole map size + uint16 w = TS[0]->W, h = TS[0]->H; + uint8 * v = (uint8 *) TS[0]->V; + uint16 dsiz = w >> 2; // data size (1 plane line size) + uint16 lsiz = 2 + dsiz + 2; // uint16 for line header, uint16 for gap + uint16 psiz = h * lsiz; // - last gape, but + plane trailer + uint16 size = 4 * psiz; // whole map size // claer whole rectangle memset(v+2, TEXT_BG, dsiz); // data bytes memcpy(v + lsiz, v, psiz - lsiz); // tricky replicate lines - * (word *) (v + psiz - 2) = EOI; // plane trailer word + * (uint16 *) (v + psiz - 2) = EOI; // plane trailer uint16 memcpy(v + psiz, v, 3 * psiz); // tricky replicate planes // paint text line if (tx) { - byte * p = v + 2, * q = p + size; + uint8 * p = v + 2, * q = p + size; while (* tx) { - word cw = Font.Wid[*tx], i; - byte * fp = Font.Map + Font.Pos[*tx]; + uint16 cw = Font.Wid[*tx], i; + uint8 * fp = Font.Map + Font.Pos[*tx]; for (i = 0; i < cw; i ++) { - register word b = fp[i]; - word n; + register uint16 b = fp[i]; + uint16 n; for (n = 0; n < FONT_HIG; n ++) { if (b & 1) *p = TEXT_FG; diff --git a/engines/cge/talk.h b/engines/cge/talk.h index c84891f7a0..dff61eaf4b 100644 --- a/engines/cge/talk.h +++ b/engines/cge/talk.h @@ -52,15 +52,15 @@ class FONT char Path[MAXPATH]; void Load (void); public: -// static byte Wid[256]; -// static word Pos[256]; -// static byte Map[256*8]; - byte * Wid; - word * Pos; - byte * Map; +// static uint8 Wid[256]; +// static uint16 Pos[256]; +// static uint8 Map[256*8]; + uint8 * Wid; + uint16 * Pos; + uint8 * Map; FONT (const char * name); ~FONT (void); - word Width (const char * text); + uint16 Width (const char * text); void Save (void); }; @@ -77,7 +77,7 @@ class TALK : public SPRITE protected: TBOX_STYLE Mode; BITMAP * TS[2]; - BITMAP * Box(word w, word h); + BITMAP * Box(uint16 w, uint16 h); public: static FONT Font; TALK (const char * tx, TBOX_STYLE mode = PURE); @@ -98,7 +98,7 @@ class INFO_LINE : public TALK { const char * OldTxt; public: - INFO_LINE (word wid); + INFO_LINE (uint16 wid); void Update (const char * tx); }; diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp index 34b99ac7eb..bb4757e541 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -225,7 +225,7 @@ void Say (const char * txt, SPRITE * spr) int x = (east) ? (spr->X+spr->W-2) : (spr->X+2); int y = spr->Y+2; SPRITE * spike = new SPRITE(SP); - word sw = spike->W; + uint16 sw = spike->W; if (east) { diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 386ccca140..e2588b74f5 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -113,7 +113,7 @@ char * NumStr (char * str, int num) static void Video (void) { - static word SP_S; + static uint16 SP_S; asm push bx asm push bp @@ -136,9 +136,9 @@ static void Video (void) -word * SaveScreen (void) +uint16 * SaveScreen (void) { - word cxy, cur, siz, * scr = NULL, * sav; + uint16 cxy, cur, siz, * scr = NULL, * sav; // horizontal size of text mode screen asm mov ah,0x0F // get current video mode @@ -179,7 +179,7 @@ word * SaveScreen (void) _AH = 0x03; Video(); // get cursor cxy = _DX; - sav = farnew(word, siz+3); // +3 extra words for size and cursor + sav = farnew(uint16, siz+3); // +3 extra uint16s for size and cursor if (sav) { sav[0] = siz; @@ -194,9 +194,9 @@ word * SaveScreen (void) -void RestoreScreen (word * &sav) +void RestoreScreen (uint16 * &sav) { - word * scr = NULL; + uint16 * scr = NULL; asm mov ax,0x40 // system data segment asm mov es,ax @@ -228,7 +228,7 @@ void RestoreScreen (word * &sav) -DAC MkDAC (byte r, byte g, byte b) +DAC MkDAC (uint8 r, uint8 g, uint8 b) { static DAC x; x.R = r; @@ -240,7 +240,7 @@ DAC MkDAC (byte r, byte g, byte b) -RGB MkRGB (byte r, byte g, byte b) +RGB MkRGB (uint8 r, uint8 g, uint8 b) { static TRGB x; x.dac.R = r; @@ -268,7 +268,7 @@ SPRITE * Locate (int ref) bool HEART::Enable = false; -word * HEART::XTimer = NULL; +uint16 * HEART::XTimer = NULL; @@ -283,16 +283,16 @@ HEART::HEART (void) extern "C" void TimerProc (void) { static SPRITE * spr; - static byte run = 0; + static uint8 run = 0; - // decrement external timer word + // decrement external timer uint16 if (HEART::XTimer) if (*HEART::XTimer) -- *HEART::XTimer; else HEART::XTimer = NULL; if (! run && HEART::Enable) // check overrun flag { - static word oldSP, oldSS; + static uint16 oldSP, oldSS; ++ run; // disable 2nd call until current lasts asm mov ax,ds @@ -319,7 +319,7 @@ extern "C" void TimerProc (void) void interrupt ENGINE::NewTimer (...) { static SPRITE * spr; - static byte run = 0, cntr1 = TMR_RATE1, cntr2 = TMR_RATE2; + static uint8 run = 0, cntr1 = TMR_RATE1, cntr2 = TMR_RATE2; ___1152_Hz___: @@ -350,14 +350,14 @@ void interrupt ENGINE::NewTimer (...) my_int: //------72Hz-------// - // decrement external timer word + // decrement external timer uint16 if (HEART::XTimer) if (*HEART::XTimer) -- *HEART::XTimer; else HEART::XTimer = NULL; if (! run && HEART::Enable) // check overrun flag { - static word oldSP, oldSS; + static uint16 oldSP, oldSS; ++ run; // disable 2nd call until current lasts asm mov ax,ds @@ -383,7 +383,7 @@ void interrupt ENGINE::NewTimer (...) -void HEART::SetXTimer (word * ptr) +void HEART::SetXTimer (uint16 * ptr) { if (XTimer && ptr != XTimer) *XTimer = 0; XTimer = ptr; @@ -392,7 +392,7 @@ void HEART::SetXTimer (word * ptr) -void HEART::SetXTimer (word * ptr, word time) +void HEART::SetXTimer (uint16 * ptr, uint16 time) { SetXTimer(ptr); *ptr = time; @@ -415,7 +415,7 @@ SPRITE::SPRITE (BMP_PTR * shp) Ext(NULL), Ref(-1), Cave(0) { memset(File, 0, sizeof(File)); - *((word *)&Flags) = 0; + *((uint16 *)&Flags) = 0; SetShapeList(shp); } @@ -486,7 +486,7 @@ BMP_PTR * SPRITE::SetShapeList (BMP_PTR * shp) -void SPRITE::MoveShapes (byte * buf) +void SPRITE::MoveShapes (uint8 * buf) { BMP_PTR * p; for (p = Ext->ShpList; *p; p ++) @@ -779,7 +779,7 @@ void SPRITE::Tick (void) -void SPRITE::MakeXlat (byte * x) +void SPRITE::MakeXlat (uint8 * x) { if (Ext) { @@ -800,11 +800,11 @@ void SPRITE::KillXlat (void) if (Flags.Xlat && Ext) { BMP_PTR * b; - byte * m = (*Ext->ShpList)->M; + uint8 * m = (*Ext->ShpList)->M; switch (MemType(m)) { - case NEAR_MEM : delete[] (byte *) m; break; + case NEAR_MEM : delete[] (uint8 *) m; break; case FAR_MEM : farfree(m); break; } for (b = Ext->ShpList; *b; b ++) (*b)->M = NULL; @@ -883,9 +883,9 @@ void SPRITE::Show (void) -void SPRITE::Show (word pg) +void SPRITE::Show (uint16 pg) { - byte * a = VGA::Page[1]; + uint8 * a = VGA::Page[1]; VGA::Page[1] = VGA::Page[pg & 3]; Shp()->Show(X, Y); VGA::Page[1] = a; @@ -912,13 +912,13 @@ BMP_PTR SPRITE::Ghost (void) register SPREXT * e = Ext; if (e->b1) { - BMP_PTR bmp = new BITMAP(0, 0, (byte *)NULL); + BMP_PTR bmp = new BITMAP(0, 0, (uint8 *)NULL); if (bmp == NULL) VGA::Exit("No core"); bmp->W = e->b1->W; bmp->H = e->b1->H; if ((bmp->B = farnew(HideDesc, bmp->H)) == NULL) VGA::Exit("No Core"); - bmp->V = (byte *) _fmemcpy(bmp->B, e->b1->B, sizeof(HideDesc) * bmp->H); - bmp->M = (byte *) MK_FP(e->y1, e->x1); + bmp->V = (uint8 *) _fmemcpy(bmp->B, e->b1->B, sizeof(HideDesc) * bmp->H); + bmp->M = (uint8 *) MK_FP(e->y1, e->x1); return bmp; } return NULL; @@ -1083,9 +1083,9 @@ SPRITE * QUEUE::Locate (int ref) -word VGA::StatAdr = VGAST1_; -word VGA::OldMode = 0; -word * VGA::OldScreen = NULL; +uint16 VGA::StatAdr = VGAST1_; +uint16 VGA::OldMode = 0; +uint16 * VGA::OldScreen = NULL; const char * VGA::Msg = NULL; const char * VGA::Nam = NULL; DAC * VGA::OldColors = NULL; @@ -1093,10 +1093,10 @@ DAC * VGA::NewColors = NULL; bool VGA::SetPal = false; int VGA::Mono = 0; QUEUE VGA::ShowQ = true, VGA::SpareQ = false; -byte * VGA::Page[4] = { (byte *) MK_FP(SCR_SEG, 0x0000), - (byte *) MK_FP(SCR_SEG, 0x4000), - (byte *) MK_FP(SCR_SEG, 0x8000), - (byte *) MK_FP(SCR_SEG, 0xC000) }; +uint8 * VGA::Page[4] = { (uint8 *) MK_FP(SCR_SEG, 0x0000), + (uint8 *) MK_FP(SCR_SEG, 0x4000), + (uint8 *) MK_FP(SCR_SEG, 0x8000), + (uint8 *) MK_FP(SCR_SEG, 0xC000) }; @@ -1453,7 +1453,7 @@ void VGA::UpdateColors (void) void VGA::Update (void) { - byte * p = Page[1]; + uint8 * p = Page[1]; Page[1] = Page[0]; Page[0] = p; @@ -1481,9 +1481,9 @@ void VGA::Update (void) -void VGA::Clear (byte color) +void VGA::Clear (uint8 color) { - byte * a = (byte *) MK_FP(SCR_SEG, 0); + uint8 * a = (uint8 *) MK_FP(SCR_SEG, 0); asm mov dx,VGASEQ_ asm mov ax,0x0F02 // map mask register - enable all planes @@ -1502,9 +1502,9 @@ void VGA::Clear (byte color) -void VGA::CopyPage (word d, word s) +void VGA::CopyPage (uint16 d, uint16 s) { - byte * S = Page[s & 3], * D = Page[d & 3]; + uint8 * S = Page[s & 3], * D = Page[d & 3]; asm mov dx,VGAGRA_ asm mov al,0x05 // R/W mode @@ -1571,11 +1571,11 @@ void VGA::Exit (int tref, const char * name) void BITMAP::XShow (int x, int y) { - byte rmsk = x % 4, + uint8 rmsk = x % 4, mask = 1 << rmsk, * scr = VGA::Page[1] + y * (SCR_WID / 4) + x / 4; - byte * m = (char *) M; - byte * v = V; + uint8 * m = (char *) M; + uint8 * v = V; asm push bx asm push si @@ -1657,9 +1657,9 @@ void BITMAP::XShow (int x, int y) void BITMAP::Show (int x, int y) { - byte mask = 1 << (x & 3), + uint8 mask = 1 << (x & 3), * scr = VGA::Page[1] + y * (SCR_WID >> 2) + (x >> 2); - byte * v = V; + uint8 * v = V; asm push ds // preserve DS @@ -1728,11 +1728,11 @@ void BITMAP::Show (int x, int y) void BITMAP::Hide (int x, int y) { - byte * scr = VGA::Page[1] + y * (SCR_WID / 4) + x / 4; - word d = FP_OFF(VGA::Page[2]) - FP_OFF(VGA::Page[1]); + uint8 * scr = VGA::Page[1] + y * (SCR_WID / 4) + x / 4; + uint16 d = FP_OFF(VGA::Page[2]) - FP_OFF(VGA::Page[1]); HideDesc * b = B; - word extra = ((x & 3) != 0); - word h = H; + uint16 extra = ((x & 3) != 0); + uint16 h = H; // asm push bx asm push si diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index d7ef11f36d..b3b411096e 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -70,7 +70,7 @@ #endif #define NO_SEQ (-1) -#define NO_PTR ((byte)-1) +#define NO_PTR ((uint8)-1) #define SPR_EXT ".SPR" @@ -79,9 +79,9 @@ -typedef struct { word r : 2; word R : 6; - word g : 2; word G : 6; - word b : 2; word B : 6; +typedef struct { uint16 r : 2; uint16 R : 6; + uint16 g : 2; uint16 G : 6; + uint16 b : 2; uint16 B : 6; } RGB; typedef union { @@ -89,9 +89,9 @@ typedef union { RGB rgb; } TRGB; -typedef struct { byte idx, adr; byte clr, set; } VgaRegBlk; +typedef struct { uint8 idx, adr; uint8 clr, set; } VgaRegBlk; -typedef struct { byte Now, Next; signed char Dx, Dy; int Dly; } SEQ; +typedef struct { uint8 Now, Next; signed char Dx, Dy; int Dly; } SEQ; extern SEQ Seq1[]; extern SEQ Seq2[]; @@ -127,9 +127,9 @@ class HEART : public ENGINE friend ENGINE; public: static bool Enable; - static word * XTimer; - static void SetXTimer (word * ptr); - static void SetXTimer (word * ptr, word time); + static uint16 * XTimer; + static void SetXTimer (uint16 * ptr); + static void SetXTimer (uint16 * ptr, uint16 time); HEART (void); }; @@ -166,28 +166,28 @@ protected: public: int Ref; signed char Cave; - struct FLAGS { word Hide : 1; // general visibility switch - word Near : 1; // Near action lock - word Drag : 1; // sprite is moveable - word Hold : 1; // sprite is held with mouse - word ____ : 1; // intrrupt driven animation - word Slav : 1; // slave object - word Syst : 1; // system object - word Kill : 1; // dispose memory after remove - word Xlat : 1; // 2nd way display: xlat table - word Port : 1; // portable - word Kept : 1; // kept in pocket - word East : 1; // talk to east (in opposite to west) - word Shad : 1; // shadow - word Back : 1; // 'send to background' request - word BDel : 1; // delete bitmaps in ~SPRITE - word Tran : 1; // transparent (untouchable) + struct FLAGS { uint16 Hide : 1; // general visibility switch + uint16 Near : 1; // Near action lock + uint16 Drag : 1; // sprite is moveable + uint16 Hold : 1; // sprite is held with mouse + uint16 ____ : 1; // intrrupt driven animation + uint16 Slav : 1; // slave object + uint16 Syst : 1; // system object + uint16 Kill : 1; // dispose memory after remove + uint16 Xlat : 1; // 2nd way display: xlat table + uint16 Port : 1; // portable + uint16 Kept : 1; // kept in pocket + uint16 East : 1; // talk to east (in opposite to west) + uint16 Shad : 1; // shadow + uint16 Back : 1; // 'send to background' request + uint16 BDel : 1; // delete bitmaps in ~SPRITE + uint16 Tran : 1; // transparent (untouchable) } Flags; int X, Y; signed char Z; - word W, H; - word Time; - byte NearPtr, TakePtr; + uint16 W, H; + uint16 Time; + uint8 NearPtr, TakePtr; int SeqPtr; int ShpCnt; char File[MAXFILE]; @@ -199,7 +199,7 @@ public: virtual ~SPRITE (void); BMP_PTR Shp (void); BMP_PTR * SetShapeList (BMP_PTR * shp); - void MoveShapes (byte * buf); + void MoveShapes (uint8 * buf); SPRITE * Expand (void); SPRITE * Contract (void); SPRITE * BackShow (bool fast = false); @@ -210,13 +210,13 @@ public: void Show (void); void Hide (void); BMP_PTR Ghost (void); - void Show (word pg); - void MakeXlat (byte * x); + void Show (uint16 pg); + void MakeXlat (uint8 * x); void KillXlat (void); void Step (int nr = -1); SEQ * SetSeq (SEQ * seq); SNAIL::COM * SnList(SNLIST type); - virtual void Touch (word mask, int x, int y); + virtual void Touch (uint16 mask, int x, int y); virtual void Tick (void); }; @@ -250,9 +250,9 @@ public: class VGA { - static word OldMode; - static word * OldScreen; - static word StatAdr; + static uint16 OldMode; + static uint16 * OldScreen; + static uint16 StatAdr; static bool SetPal; static DAC * OldColors, * NewColors; static int SetMode (int mode); @@ -263,19 +263,19 @@ class VGA static void SetStatAdr (void); static void WaitVR (bool on = true); public: - dword FrmCnt; + uint32 FrmCnt; static QUEUE ShowQ, SpareQ; static int Mono; - static byte * Page[4]; + static uint8 * Page[4]; VGA (int mode = M13H); ~VGA (void); void Setup (VgaRegBlk * vrb); static void GetColors (DAC * tab); static void SetColors (DAC * tab, int lum); - static void Clear (byte color = 0); + static void Clear (uint8 color = 0); static void Exit (const char * txt = NULL, const char * name = NULL); static void Exit (int tref, const char * name = NULL); - static void CopyPage (word d, word s = 3); + static void CopyPage (uint16 d, uint16 s = 3); static void Sunrise (DAC * tab); static void Sunset (void); void Show (void); @@ -284,24 +284,24 @@ public: -DAC MkDAC (byte r, byte g, byte b); -RGB MkRGB (byte r, byte g, byte b); +DAC MkDAC (uint8 r, uint8 g, uint8 b); +RGB MkRGB (uint8 r, uint8 g, uint8 b); template <class CBLK> -byte Closest (CBLK * pal, CBLK x) +uint8 Closest (CBLK * pal, CBLK x) { - #define f(col,lum) ((((word)(col))<<8)/lum) - word i, dif = 0xFFFF, found; - word L = x.R + x.G + x.B; if (! L) ++ L; - word R = f(x.R, L), G = f(x.G, L), B = f(x.B, L); + #define f(col,lum) ((((uint16)(col))<<8)/lum) + uint16 i, dif = 0xFFFF, found; + uint16 L = x.R + x.G + x.B; if (! L) ++ L; + uint16 R = f(x.R, L), G = f(x.G, L), B = f(x.B, L); for (i = 0; i < 256; i ++) { - word l = pal[i].R + pal[i].G + pal[i].B; if (! l) ++ l; + uint16 l = pal[i].R + pal[i].G + pal[i].B; if (! l) ++ l; int r = f(pal[i].R, l), g = f(pal[i].G, l), b = f(pal[i].B, l); - word D = ((r > R) ? (r - R) : (R - r)) + + uint16 D = ((r > R) ? (r - R) : (R - r)) + ((g > G) ? (g - G) : (G - g)) + ((b > B) ? (b - B) : (B - b)) + ((l > L) ? (l - L) : (L - l)) * 10 ; @@ -325,8 +325,8 @@ byte Closest (CBLK * pal, CBLK x) char * NumStr (char * str, int num); void Video (void); - word * SaveScreen (void); - void RestoreScreen (word * &sav); + uint16 * SaveScreen (void); + void RestoreScreen (uint16 * &sav); SPRITE * SpriteAt (int x, int y); SPRITE * Locate (int ref); diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index f7314e18ea..1459314ba0 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -45,10 +45,10 @@ -MENU_BAR::MENU_BAR (word w) +MENU_BAR::MENU_BAR (uint16 w) { int h = FONT_HIG + 2 * MB_VM, i = (w += 2 * MB_HM) * h; - byte * p = farnew(byte, i), * p1, * p2; + uint8 * p = farnew(uint8, i), * p1, * p2; _fmemset(p+w, TRANS, i-2*w); _fmemset(p, MB_LT, w); @@ -88,7 +88,7 @@ char * VMGather (CHOICE * list) len += strlen(cp->Text); ++ h; } - vmgt = new byte[len+h]; + vmgt = new uint8[len+h]; if (vmgt) { *vmgt = '\0'; @@ -141,7 +141,7 @@ VMENU::~VMENU (void) -void VMENU::Touch (word mask, int x, int y) +void VMENU::Touch (uint16 mask, int x, int y) { #define h (FONT_HIG+TEXT_LS) int n = 0; diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h index 23c354b504..d2b70145df 100644 --- a/engines/cge/vmenu.h +++ b/engines/cge/vmenu.h @@ -45,7 +45,7 @@ typedef struct { char * Text; void (* Proc)(void); } CHOICE; class MENU_BAR : public TALK { public: - MENU_BAR (word w); + MENU_BAR (uint16 w); }; @@ -56,7 +56,7 @@ public: class VMENU : public TALK { - word Items; + uint16 Items; CHOICE * Menu; public: static VMENU * Addr; @@ -64,7 +64,7 @@ public: MENU_BAR * Bar; VMENU (CHOICE * list, int x, int y); ~VMENU (void); - void Touch (word mask, int x, int y); + void Touch (uint16 mask, int x, int y); }; diff --git a/engines/cge/vol.cpp b/engines/cge/vol.cpp index 503c6cab91..b0cf1c068c 100644 --- a/engines/cge/vol.cpp +++ b/engines/cge/vol.cpp @@ -101,6 +101,6 @@ void VFILE::ReadBuff (void) BufMark = Dat.File.Mark(); long n = EndMark - BufMark; if (n > IOBUF_SIZE) n = IOBUF_SIZE; - Lim = Dat.File.Read(Buff, (word) n); + Lim = Dat.File.Read(Buff, (uint16) n); Ptr = 0; } diff --git a/engines/cge/vol.h b/engines/cge/vol.h index 1357c24814..99284fddd5 100644 --- a/engines/cge/vol.h +++ b/engines/cge/vol.h @@ -55,9 +55,9 @@ class DAT friend VFILE; static VOLBASE File; public: - static bool Append (byte * buf, word len); + static bool Append (uint8 * buf, uint16 len); static bool Write (CFILE& f); - static bool Read (long org, word len, byte * buf); + static bool Read (long org, uint16 len, uint8 * buf); }; diff --git a/engines/cge/wav.h b/engines/cge/wav.h index 1998672bed..0fc2ab4d0d 100644 --- a/engines/cge/wav.h +++ b/engines/cge/wav.h @@ -39,17 +39,17 @@ typedef char FOURCC[4]; // Four-character code -typedef dword CKSIZE; // 32-bit unsigned size +typedef uint32 CKSIZE; // 32-bit unsigned size class CKID // Chunk type identifier { - union { FOURCC Tx; dword Id; }; + union { FOURCC Tx; uint32 Id; }; protected: static XFILE * ckFile; public: CKID (FOURCC t) { memcpy(Tx, t, sizeof(Tx)); } - CKID (dword d) { Id = d; } + CKID (uint32 d) { Id = d; } CKID (XFILE * xf) { (ckFile = xf)->Read(Tx, sizeof(Tx)); } bool operator !=(CKID& X) { return Id != X.Id; } bool operator ==(CKID& X) { return Id == X.Id; } @@ -78,27 +78,27 @@ class FMTCK : public CKHEA { struct WAV { - word wFormatTag; // Format category - word wChannels; // Number of channels - dword dwSamplesPerSec; // Sampling rate - dword dwAvgBytesPerSec; // For buffer estimation - word wBlockAlign; // Data block size + uint16 wFormatTag; // Format category + uint16 wChannels; // Number of channels + uint32 dwSamplesPerSec; // Sampling rate + uint32 dwAvgBytesPerSec; // For buffer estimation + uint16 wBlockAlign; // Data block size } Wav; union { struct PCM { - word wBitsPerSample; // Sample size + uint16 wBitsPerSample; // Sample size } Pcm; }; public: FMTCK (CKHEA& hea); - inline word Channels (void) { return Wav.wChannels; } - inline dword SmplRate (void) { return Wav.dwSamplesPerSec; } - inline dword ByteRate (void) { return Wav.dwAvgBytesPerSec; } - inline word BlckSize (void) { return Wav.wBlockAlign; } - inline word SmplSize (void) { return Pcm.wBitsPerSample; } + inline uint16 Channels (void) { return Wav.wChannels; } + inline uint32 SmplRate (void) { return Wav.dwSamplesPerSec; } + inline uint32 ByteRate (void) { return Wav.dwAvgBytesPerSec; } + inline uint16 BlckSize (void) { return Wav.wBlockAlign; } + inline uint16 SmplSize (void) { return Pcm.wBitsPerSample; } }; @@ -110,7 +110,7 @@ class DATACK : public CKHEA bool e; union { - byte * Buf; + uint8 * Buf; EMS * EBuf; }; public: @@ -118,7 +118,7 @@ public: DATACK (CKHEA& hea, EMM * emm); DATACK (int first, int last); ~DATACK (void); - inline byte * Addr (void) { return Buf; } + inline uint8 * Addr (void) { return Buf; } inline EMS * EAddr (void) { return EBuf; } }; |