aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cge/bitmap.cpp14
-rw-r--r--engines/cge/bitmap.h2
-rw-r--r--engines/cge/btfile.cpp2
-rw-r--r--engines/cge/btfile.h2
-rw-r--r--engines/cge/cfile.cpp18
-rw-r--r--engines/cge/cfile.h8
-rw-r--r--engines/cge/cge.cpp28
-rw-r--r--engines/cge/cge.h22
-rw-r--r--engines/cge/cge_main.cpp68
-rw-r--r--engines/cge/events.cpp6
-rw-r--r--engines/cge/general.cpp24
-rw-r--r--engines/cge/general.h23
-rw-r--r--engines/cge/gettext.cpp2
-rw-r--r--engines/cge/mixer.h4
-rw-r--r--engines/cge/snail.cpp8
-rw-r--r--engines/cge/snail.h2
-rw-r--r--engines/cge/talk.cpp72
-rw-r--r--engines/cge/talk.h10
-rw-r--r--engines/cge/text.cpp34
-rw-r--r--engines/cge/text.h14
-rw-r--r--engines/cge/vga13h.cpp96
-rw-r--r--engines/cge/vga13h.h38
-rw-r--r--engines/cge/vmenu.cpp2
-rw-r--r--engines/cge/walk.cpp58
-rw-r--r--engines/cge/walk.h26
-rw-r--r--engines/cge/wav.h10
26 files changed, 282 insertions, 311 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index c02c66df8b..ddde3bbd21 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -126,7 +126,7 @@ Bitmap::Bitmap(uint16 w, uint16 h, uint8 fill)
b->_hide = _w >> 2;
// Replicate across the entire table
- for (HideDesc *hdP = b + 1; hdP < (b + _h); ++hdP)
+ for (HideDesc *hdP = b + 1; hdP < (b + _h); hdP++)
*hdP = *b;
b->_skip = 0; // fix the first entry
@@ -195,7 +195,7 @@ uint16 Bitmap::moveVmap(uint8 *buf) {
}
-BMP_PTR Bitmap::code() {
+BitmapPtr Bitmap::code() {
debugC(1, kCGEDebugBitmap, "Bitmap::code()");
if (!_m)
@@ -421,17 +421,17 @@ bool Bitmap::loadVBM(XFile *f) {
if (p) {
if (_pal) {
// Read in the palette
- byte palData[PAL_SIZ];
- f->read(palData, PAL_SIZ);
+ byte palData[kPalSize];
+ f->read(palData, kPalSize);
const byte *srcP = palData;
- for (int idx = 0; idx < PAL_CNT; ++idx, srcP += 3) {
+ for (int idx = 0; idx < kPalCount; idx++, srcP += 3) {
_pal[idx]._r = *srcP;
_pal[idx]._g = *(srcP + 1);
_pal[idx]._b = *(srcP + 2);
}
} else
- f->seek(f->mark() + PAL_SIZ);
+ f->seek(f->mark() + kPalSize);
}
}
if ((_v = new uint8[n]) == NULL)
@@ -473,7 +473,7 @@ bool Bitmap::loadBMP(XFile *f) {
f->read((byte *)&bpal, sizeof(bpal));
if (f->_error == 0) {
if (_pal) {
- for (i = 0; i < 256; i ++) {
+ for (i = 0; i < 256; i++) {
_pal[i]._r = bpal[i]._R;
_pal[i]._g = bpal[i]._G;
_pal[i]._b = bpal[i]._B;
diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h
index 6b931573f8..30e11d08ec 100644
--- a/engines/cge/bitmap.h
+++ b/engines/cge/bitmap.h
@@ -91,7 +91,7 @@ public:
};
-typedef Bitmap *BMP_PTR;
+typedef Bitmap *BitmapPtr;
} // End of namespace CGE
diff --git a/engines/cge/btfile.cpp b/engines/cge/btfile.cpp
index 55511e6382..1f987340b7 100644
--- a/engines/cge/btfile.cpp
+++ b/engines/cge/btfile.cpp
@@ -34,7 +34,7 @@
namespace CGE {
-BtFile::BtFile(const char *name, IOMode mode, CRYPT *crpt)
+BtFile::BtFile(const char *name, IOMode mode, Crypt *crpt)
: IoHand(name, mode, crpt) {
debugC(1, kCGEDebugFile, "BtFile::BtFile(%s, %d, crpt)", name, mode);
diff --git a/engines/cge/btfile.h b/engines/cge/btfile.h
index b589e86aee..6b7155d43d 100644
--- a/engines/cge/btfile.h
+++ b/engines/cge/btfile.h
@@ -83,7 +83,7 @@ class BtFile : public IoHand {
void putPage(int lev, bool hard);
BtPage *getPage(int lev, uint16 pgn);
public:
- BtFile(const char *name, IOMode mode, CRYPT *crpt);
+ BtFile(const char *name, IOMode mode, Crypt *crpt);
virtual ~BtFile();
BtKeypack *find(const char *key);
BtKeypack *next();
diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp
index ac9f782d84..c6144f624b 100644
--- a/engines/cge/cfile.cpp
+++ b/engines/cge/cfile.cpp
@@ -33,24 +33,24 @@
namespace CGE {
-IoBuf::IoBuf(IOMode mode, CRYPT *crpt)
- : IoHand(mode, crpt),
+IoBuf::IoBuf(IOMode mode, Crypt *crypt)
+ : IoHand(mode, crypt),
_bufMark(0),
_ptr(0),
_lim(0) {
- debugC(1, kCGEDebugFile, "IoBuf::IoBuf(%d, crpt)", mode);
+ debugC(1, kCGEDebugFile, "IoBuf::IoBuf(%d, crypt)", mode);
_buff = (uint8 *) malloc(sizeof(uint8) * kBufferSize);
assert(_buff != NULL);
}
-IoBuf::IoBuf(const char *name, IOMode mode, CRYPT *crpt)
- : IoHand(name, mode, crpt),
+IoBuf::IoBuf(const char *name, IOMode mode, Crypt *crypt)
+ : IoHand(name, mode, crypt),
_bufMark(0),
_ptr(0),
_lim(0) {
- debugC(1, kCGEDebugFile, "IoBuf::IoBuf(%s, %d, crpt)", name, mode);
+ debugC(1, kCGEDebugFile, "IoBuf::IoBuf(%s, %d, crypt)", name, mode);
_buff = (uint8 *) malloc(sizeof(uint8) * kBufferSize);
assert(_buff != NULL);
@@ -220,9 +220,9 @@ void IoBuf::write(uint8 b) {
uint16 CFile::_maxLineLen = kLineMaxSize;
-CFile::CFile(const char *name, IOMode mode, CRYPT *crpt)
- : IoBuf(name, mode, crpt) {
- debugC(1, kCGEDebugFile, "CFile::CFile(%s, %d, crpt)", name, mode);
+CFile::CFile(const char *name, IOMode mode, Crypt *crypt)
+ : IoBuf(name, mode, crypt) {
+ debugC(1, kCGEDebugFile, "CFile::CFile(%s, %d, crypt)", name, mode);
}
diff --git a/engines/cge/cfile.h b/engines/cge/cfile.h
index 306ec5926b..6ed3b5e750 100644
--- a/engines/cge/cfile.h
+++ b/engines/cge/cfile.h
@@ -42,12 +42,12 @@ protected:
uint16 _lim;
long _bufMark;
uint16 _seed;
- CRYPT *_crypt;
+ Crypt *_crypt;
virtual void readBuf();
virtual void writeBuf();
public:
- IoBuf(IOMode mode, CRYPT *crpt = NULL);
- IoBuf(const char *name, IOMode mode, CRYPT *crpt = NULL);
+ IoBuf(IOMode mode, Crypt *crpt = NULL);
+ IoBuf(const char *name, IOMode mode, Crypt *crpt = NULL);
virtual ~IoBuf();
uint16 read(void *buf, uint16 len);
uint16 read(uint8 *buf);
@@ -61,7 +61,7 @@ public:
class CFile : public IoBuf {
public:
static uint16 _maxLineLen;
- CFile(const char *name, IOMode mode = kModeRead, CRYPT *crpt = NULL);
+ CFile(const char *name, IOMode mode = kModeRead, Crypt *crpt = NULL);
virtual ~CFile();
void flush();
long mark();
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 8d2073b66f..2baf1cde1e 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -59,21 +59,21 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
void CGEEngine::initCaveValues() {
if (_isDemo) {
_mini = new byte[16384];
- CAVE_DX = 23;
- CAVE_DY = 29;
- CAVE_NX = 3;
- CAVE_NY = 1;
+ _caveDx = 23;
+ _caveDy = 29;
+ _caveNx = 3;
+ _caveNy = 1;
} else {
_mini = new byte[65536];
- CAVE_DX = 9;
- CAVE_DY = 10;
- CAVE_NX = 8;
- CAVE_NY = 3;
+ _caveDx = 9;
+ _caveDy = 10;
+ _caveNx = 8;
+ _caveNy = 3;
}
- CAVE_MAX = CAVE_NX * CAVE_NY;
+ _caveMax = _caveNx * _caveNy;
if (_isDemo) {
- _maxCaveArr[0] = CAVE_MAX;
+ _maxCaveArr[0] = _caveMax;
_maxCaveArr[1] = -1;
_maxCaveArr[2] = -1;
_maxCaveArr[3] = -1;
@@ -86,14 +86,14 @@ void CGEEngine::initCaveValues() {
_maxCaveArr[4] = 24;
};
- _heroXY = (Hxy *) malloc (sizeof(Hxy) * CAVE_MAX);
- for (int i = 0; i < CAVE_MAX; i++) {
+ _heroXY = (Hxy *) malloc (sizeof(Hxy) * _caveMax);
+ for (int i = 0; i < _caveMax; i++) {
_heroXY[i]._x = 0;
_heroXY[i]._y = 0;
}
- _barriers = (Bar *) malloc (sizeof(Bar) * (1 + CAVE_MAX));
- for (int i = 0; i < CAVE_MAX + 1; i++) {
+ _barriers = (Bar *) malloc (sizeof(Bar) * (1 + _caveMax));
+ for (int i = 0; i < _caveMax + 1; i++) {
_barriers[i]._horz = 0xFF;
_barriers[i]._vert = 0xFF;
}
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 9d2503a5cf..7adc44fac6 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -133,19 +133,19 @@ public:
Sprite *_sprK2;
Sprite *_sprK3;
- uint8 CAVE_DX;
- uint8 CAVE_DY;
- uint8 CAVE_NX;
- uint8 CAVE_NY;
- uint16 CAVE_MAX;
+ uint8 _caveDx;
+ uint8 _caveDy;
+ uint8 _caveNx;
+ uint8 _caveNy;
+ uint16 _caveMax;
Hxy *_heroXY;
Bar *_barriers;
Common::RandomSource _randomSource;
- byte * _mini;
- BMP_PTR * _miniShp;
- BMP_PTR * _miniShpList;
- int _startGameSlot;
+ byte *_mini;
+ BitmapPtr *_miniShp;
+ BitmapPtr *_miniShpList;
+ int _startGameSlot;
virtual Common::Error run();
GUI::Debugger *getDebugger() {
@@ -168,7 +168,7 @@ public:
bool showTitle(const char *name);
void movie(const char *ext);
void takeName();
- void inf(const char *txt);
+ void inf(const char *text);
void selectSound();
void dummy() {}
void NONE();
@@ -202,7 +202,7 @@ public:
void saveMapping();
void saveSound();
void heroCover(int cvr);
- void trouble(int seq, int txt);
+ void trouble(int seq, int text);
void offUse();
void tooFar();
void loadHeroXY();
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 123501047a..37449fd5dd 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -109,30 +109,30 @@ void CGEEngine::syncHeader(Common::Serializer &s) {
s.syncAsUint16LE(_now);
s.syncAsUint16LE(_oldLev);
s.syncAsUint16LE(_demoText);
- for (i = 0; i < 5; ++i)
+ for (i = 0; i < 5; i++)
s.syncAsUint16LE(_game);
s.syncAsSint16LE(i); // unused VGA::Mono variable
s.syncAsUint16LE(_music);
s.syncBytes(_volume, 2);
- for (i = 0; i < 4; ++i)
+ for (i = 0; i < 4; i++)
s.syncAsUint16LE(_flag[i]);
initCaveValues();
if (s.isLoading()) {
//TODO: Fix the memory leak when the game is already running
- _heroXY = (Hxy *) malloc (sizeof(Hxy) * CAVE_MAX);
- _barriers = (Bar *) malloc (sizeof(Bar) * (1 + CAVE_MAX));
+ _heroXY = (Hxy *) malloc (sizeof(Hxy) * _caveMax);
+ _barriers = (Bar *) malloc (sizeof(Bar) * (1 + _caveMax));
}
- for (i = 0; i < CAVE_MAX; ++i) {
+ for (i = 0; i < _caveMax; i++) {
s.syncAsSint16LE(_heroXY[i]._x);
s.syncAsUint16LE(_heroXY[i]._y);
}
- for (i = 0; i < 1 + CAVE_MAX; ++i) {
+ for (i = 0; i < 1 + _caveMax; i++) {
s.syncAsByte(_barriers[i]._horz);
s.syncAsByte(_barriers[i]._vert);
}
- for (i = 0; i < kPocketNX; ++i)
+ for (i = 0; i < kPocketNX; i++)
s.syncAsUint16LE(_pocref[i]);
if (s.isSaving()) {
@@ -409,15 +409,15 @@ void CGEEngine::heroCover(int cvr) {
_snail->addCom(kSnCover, 1, cvr, NULL);
}
-void CGEEngine::trouble(int seq, int txt) {
- debugC(1, kCGEDebugEngine, "CGEEngine::trouble(%d, %d)", seq, txt);
+void CGEEngine::trouble(int seq, int text) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::trouble(%d, %d)", seq, text);
_hero->park();
_snail->addCom(kSnWait, -1, -1, _hero);
_snail->addCom(kSnSeq, -1, seq, _hero);
_snail->addCom(kSnSound, -1, 2, _hero);
_snail->addCom(kSnWait, -1, -1, _hero);
- _snail->addCom(kSnSay, 1, txt, _hero);
+ _snail->addCom(kSnSay, 1, text, _hero);
}
void CGEEngine::offUse() {
@@ -444,7 +444,7 @@ void CGEEngine::loadHeroXY() {
void CGEEngine::loadMapping() {
debugC(1, kCGEDebugEngine, "CGEEngine::loadMapping()");
- if (_now <= CAVE_MAX) {
+ if (_now <= _caveMax) {
INI_FILE cf(progName(".TAB"));
if (!cf._error) {
memset(Cluster::_map, 0, sizeof(Cluster::_map));
@@ -458,7 +458,7 @@ Square::Square(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
_flags._kill = true;
_flags._bDel = false;
- BMP_PTR *MB = new BMP_PTR[2];
+ BitmapPtr *MB = new BitmapPtr[2];
MB[0] = new Bitmap("BRICK", true);
MB[1] = NULL;
setShapeList(MB);
@@ -480,7 +480,7 @@ void CGEEngine::setMapBrick(int x, int z) {
Square *s = new Square(this);
if (s) {
static char n[] = "00:00";
- s->gotoxy(x * MAP_XGRID, MAP_TOP + z * MAP_ZGRID);
+ s->gotoxy(x * kMapGridX, kMapTop + z * kMapGridZ);
wtom(x, n + 0, 10, 2);
wtom(z, n + 3, 10, 2);
Cluster::_map[z][x] = 1;
@@ -688,8 +688,8 @@ void CGEEngine::switchCave(int cav) {
if (!_isDemo)
_vga->_spareQ->_show = 0;
}
- _cavLight->gotoxy(CAVE_X + ((_now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX,
- CAVE_Y + ((_now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY);
+ _cavLight->gotoxy(CAVE_X + ((_now - 1) % _caveNx) * _caveDx + CAVE_SX,
+ CAVE_Y + ((_now - 1) / _caveNx) * _caveDy + CAVE_SY);
killText();
if (!_startupMode)
keyClick();
@@ -837,9 +837,9 @@ void System::touch(uint16 mask, int x, int y) {
_infoLine->update(NULL);
if (y >= kWorldHeight ) {
if (x < kButtonX) { // select cave?
- if (y >= CAVE_Y && y < CAVE_Y + _vm->CAVE_NY * _vm->CAVE_DY &&
- x >= CAVE_X && x < CAVE_X + _vm->CAVE_NX * _vm->CAVE_DX && !_vm->_game) {
- cav = ((y - CAVE_Y) / _vm->CAVE_DY) * _vm->CAVE_NX + (x - CAVE_X) / _vm->CAVE_DX + 1;
+ if (y >= CAVE_Y && y < CAVE_Y + _vm->_caveNy * _vm->_caveDy &&
+ x >= CAVE_X && x < CAVE_X + _vm->_caveNx * _vm->_caveDx && !_vm->_game) {
+ cav = ((y - CAVE_Y) / _vm->_caveDy) * _vm->_caveNx + (x - CAVE_X) / _vm->_caveDx + 1;
if (cav > _vm->_maxCave)
cav = 0;
} else {
@@ -861,7 +861,7 @@ void System::touch(uint16 mask, int x, int y) {
_vm->switchCave(cav);
if (!_horzLine->_flags._hide) {
- if (y >= MAP_TOP && y < MAP_TOP + MAP_HIG) {
+ if (y >= kMapTop && y < kMapTop + kMapHig) {
int8 x1, z1;
XZ(x, y).split(x1, z1);
Cluster::_map[z1][x1] = 1;
@@ -869,7 +869,7 @@ void System::touch(uint16 mask, int x, int y) {
}
} else {
if (!_talk && _snail->idle() && _hero
- && y >= MAP_TOP && y < MAP_TOP + MAP_HIG && !_vm->_game) {
+ && y >= kMapTop && y < kMapTop + kMapHig && !_vm->_game) {
_hero->findWay(XZ(x, y));
}
}
@@ -964,9 +964,9 @@ void CGEEngine::switchMapping() {
if (_horzLine->_flags._hide) {
int i;
- for (i = 0; i < MAP_ZCNT; i++) {
+ for (i = 0; i < kMapZCnt; i++) {
int j;
- for (j = 0; j < MAP_XCNT; j++) {
+ for (j = 0; j < kMapXCnt; j++) {
if (Cluster::_map[i][j])
setMapBrick(j, i);
}
@@ -974,7 +974,7 @@ void CGEEngine::switchMapping() {
} else {
Sprite *s;
for (s = _vga->_showQ->first(); s; s = s->_next)
- if (s->_w == MAP_XGRID && s->_h == MAP_ZGRID)
+ if (s->_w == kMapGridX && s->_h == kMapGridZ)
_snail_->addCom(kSnKill, -1, 0, s);
}
_horzLine->_flags._hide = !_horzLine->_flags._hide;
@@ -1526,7 +1526,7 @@ void CGEEngine::runGame() {
killMidi();
if (_mini && INI_FILE::exist("MINI.SPR")) {
- _miniShp = new BMP_PTR[2];
+ _miniShp = new BitmapPtr[2];
_miniShp[0] = _miniShp[1] = NULL;
uint8 *ptr = (uint8 *) &*_mini;
@@ -1568,7 +1568,7 @@ void CGEEngine::runGame() {
_debugLine->_z = 126;
_vga->_showQ->insert(_debugLine);
- _horzLine->_y = MAP_TOP - (MAP_TOP > 0);
+ _horzLine->_y = kMapTop - (kMapTop > 0);
_horzLine->_z = 126;
_vga->_showQ->insert(_horzLine);
@@ -1579,8 +1579,8 @@ void CGEEngine::runGame() {
_startupMode = 0;
_snail->addCom(kSnLevel, -1, _oldLev, &_cavLight);
- _cavLight->gotoxy(CAVE_X + ((_now - 1) % CAVE_NX) * CAVE_DX + CAVE_SX,
- CAVE_Y + ((_now - 1) / CAVE_NX) * CAVE_DY + CAVE_SY);
+ _cavLight->gotoxy(CAVE_X + ((_now - 1) % _caveNx) * _caveDx + CAVE_SX,
+ CAVE_Y + ((_now - 1) / _caveNx) * _caveDy + CAVE_SY);
caveUp();
_keyboard->setClient(_sys);
@@ -1630,11 +1630,11 @@ bool CGEEngine::showTitle(const char *name) {
return false;
Bitmap::_pal = Vga::_sysPal;
- BMP_PTR *LB = new BMP_PTR[2];
+ BitmapPtr *LB = new BitmapPtr[2];
LB[0] = new Bitmap(name, true);
LB[1] = NULL;
Bitmap::_pal = NULL;
- bool usr_ok = false;
+ bool userOk = false;
Sprite D(this, LB);
D._flags._kill = true;
@@ -1675,7 +1675,7 @@ bool CGEEngine::showTitle(const char *name) {
if (_mode < 2) {
if (_isDemo) {
strcpy(_usrFnam, progName(kSvgExt));
- usr_ok = true;
+ userOk = true;
} else {
#ifndef EVA
// At this point the game originally set the protection variables
@@ -1689,7 +1689,7 @@ bool CGEEngine::showTitle(const char *name) {
// For ScummVM, skip prompting for name if a savegame in slot 0 already exists
if ((_startGameSlot == -1) && savegameExists(0)) {
strcpy(_usrFnam, "User");
- usr_ok = true;
+ userOk = true;
} else {
for (takeName(); GetText::_ptr;) {
mainLoop();
@@ -1697,7 +1697,7 @@ bool CGEEngine::showTitle(const char *name) {
return false;
}
if (_keyboard->last() == Enter && *_usrFnam)
- usr_ok = true;
+ userOk = true;
}
//Mouse.Off();
_vga->_showQ->clear();
@@ -1705,7 +1705,7 @@ bool CGEEngine::showTitle(const char *name) {
#endif
}
- if (usr_ok && _mode == 0) {
+ if (userOk && _mode == 0) {
if (savegameExists(0)) {
// Load the savegame
loadGame(0, NULL, true); // only system vars
@@ -1728,7 +1728,7 @@ bool CGEEngine::showTitle(const char *name) {
if (_isDemo)
return true;
else
- return (_mode == 2 || usr_ok);
+ return (_mode == 2 || userOk);
}
void CGEEngine::cge_main() {
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp
index dc6e65722d..1c2738f62e 100644
--- a/engines/cge/events.cpp
+++ b/engines/cge/events.cpp
@@ -110,7 +110,7 @@ bool Keyboard::getKey(uint16 keycode, int &cgeCode) {
}
// Scan through the ScummVM mapping list
- for (int idx = 0; idx < 0x60; ++idx) {
+ for (int idx = 0; idx < 0x60; idx++) {
if (_scummVmCodes[idx] == keycode) {
cgeCode = idx;
return true;
@@ -163,13 +163,13 @@ Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0)
Common::copy(ms, ms + 2, seq);
setSeq(seq);
- BMP_PTR *MC = new BMP_PTR[3];
+ BitmapPtr *MC = new BitmapPtr[3];
MC[0] = new Bitmap("MOUSE", true);
MC[1] = new Bitmap("DUMMY", true);
MC[2] = NULL;
setShapeList(MC);
- gotoxy(kScrWidth/2, kScrHeight/2);
+ gotoxy(kScrWidth / 2, kScrHeight / 2);
_z = 127;
step(1);
}
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 1947fc6061..8e141a8be4 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -110,8 +110,8 @@ const char *progName(const char *ext) {
return buf;
}
-char *mergeExt(char *buf, const char *nam, const char *ext) {
- strcpy(buf, nam);
+char *mergeExt(char *buf, const char *name, const char *ext) {
+ strcpy(buf, name);
char *dot = strrchr(buf, '.');
if (!dot)
strcat(buf, ext);
@@ -119,8 +119,8 @@ char *mergeExt(char *buf, const char *nam, const char *ext) {
return buf;
}
-char *forceExt(char *buf, const char *nam, const char *ext) {
- strcpy(buf, nam);
+char *forceExt(char *buf, const char *name, const char *ext) {
+ strcpy(buf, name);
char *dot = strrchr(buf, '.');
if (dot)
*dot = '\0';
@@ -204,13 +204,13 @@ char *dwtom(uint32 val, char *str, int radix, int len) {
return str;
}
-IoHand::IoHand(IOMode mode, CRYPT *crpt)
- : XFile(mode), _crypt(crpt), _seed(kCryptSeed) {
+IoHand::IoHand(IOMode mode, Crypt *crypt)
+ : XFile(mode), _crypt(crypt), _seed(kCryptSeed) {
_file = new Common::File();
}
-IoHand::IoHand(const char *name, IOMode mode, CRYPT *crpt)
- : XFile(mode), _crypt(crpt), _seed(kCryptSeed) {
+IoHand::IoHand(const char *name, IOMode mode, Crypt *crypt)
+ : XFile(mode), _crypt(crypt), _seed(kCryptSeed) {
// TODO: Check if WRI and/or UPD modes are needed, and map to a save file
assert(mode == kModeRead);
@@ -303,11 +303,11 @@ DataCk *loadWave(XFile *file) {
return NULL;
}
-int takeEnum(const char **tab, const char *txt) {
+int takeEnum(const char **tab, const char *text) {
const char **e;
- if (txt) {
+ if (text) {
for (e = tab; *e; e++) {
- if (scumm_stricmp(txt, *e) == 0) {
+ if (scumm_stricmp(text, *e) == 0) {
return e - tab;
}
}
@@ -332,7 +332,7 @@ int new_random(int range) {
}
DataCk::~DataCk() {
- if (!_e && _buf)
+ if (_buf)
free(_buf);
}
} // End of namespace CGE
diff --git a/engines/cge/general.h b/engines/cge/general.h
index d55193d85c..57991f2125 100644
--- a/engines/cge/general.h
+++ b/engines/cge/general.h
@@ -47,7 +47,7 @@ struct Dac {
uint8 _b;
};
-typedef uint16 CRYPT(void *buf, uint16 siz, uint16 seed);
+typedef uint16 Crypt(void *buf, uint16 siz, uint16 seed);
template <class T>
void swap(T &A, T &B) {
@@ -92,10 +92,10 @@ class IoHand : public XFile {
protected:
Common::File *_file;
uint16 _seed;
- CRYPT *_crypt;
+ Crypt *_crypt;
public:
- IoHand(const char *name, IOMode mode = kModeRead, CRYPT crypt = NULL);
- IoHand(IOMode mode = kModeRead, CRYPT *crpt = NULL);
+ IoHand(const char *name, IOMode mode = kModeRead, Crypt crypt = NULL);
+ IoHand(IOMode mode = kModeRead, Crypt *crypt = NULL);
virtual ~IoHand();
static bool exist(const char *name);
uint16 read(void *buf, uint16 len);
@@ -105,24 +105,21 @@ public:
long seek(long pos);
};
-CRYPT XCrypt;
-CRYPT RCrypt;
+Crypt XCrypt;
+Crypt RCrypt;
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);
-int takeEnum(const char **tab, const char *txt);
+int takeEnum(const char **tab, const char *text);
uint16 chkSum(void *m, uint16 n);
long timer();
-char *mergeExt(char *buf, const char *nam, const char *ext);
-char *forceExt(char *buf, const char *nam, const char *ext);
-int driveCD(unsigned drv);
+char *mergeExt(char *buf, const char *name, const char *ext);
+char *forceExt(char *buf, const char *name, const char *ext);
// MISSING FUNCTIONS
void _fqsort(void *base, uint16 nelem, uint16 width, int (*fcmp)(const void *, const void *));
const char *progName(const char *ext = NULL);
-char *mergeExt(char *buf, const char *nam, const char *ext);
-char *forceExt(char *buf, const char *nam, const char *ext);
unsigned fastRand();
unsigned fastRand(unsigned s);
uint16 rCrypt(void *buf, uint16 siz, uint16 seed);
@@ -130,7 +127,7 @@ 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);
-int takeEnum(const char **tab, const char *txt);
+int takeEnum(const char **tab, const char *text);
long timer();
int new_random(int range);
} // End of namespace CGE
diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp
index fa30b3a9d1..f64f4b2619 100644
--- a/engines/cge/gettext.cpp
+++ b/engines/cge/gettext.cpp
@@ -41,7 +41,7 @@ GetText::GetText(CGEEngine *vm, const char *info, char *text, int size)
_ptr = this;
_mode = kTBRect;
- _ts = new BMP_PTR[2];
+ _ts = new BitmapPtr[2];
_ts[0] = box((i + 3) & ~3, 2 * kTextVMargin + 2 * kFontHigh + kTextLineSpace);
_ts[1] = NULL;
setShapeList(_ts);
diff --git a/engines/cge/mixer.h b/engines/cge/mixer.h
index d97a4f3dd3..10c05e7cfb 100644
--- a/engines/cge/mixer.h
+++ b/engines/cge/mixer.h
@@ -40,8 +40,8 @@ namespace CGE {
#define kMixName 105 // sprite name
class Mixer : public Sprite {
- BMP_PTR _mb[2];
- BMP_PTR _lb[kMixMax + 1];
+ BitmapPtr _mb[2];
+ BitmapPtr _lb[kMixMax + 1];
Sprite *_led[2];
int _fall;
void update();
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 2cd38d671f..03cb43f4f1 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -390,7 +390,7 @@ void CGEEngine::feedSnail(Sprite *spr, SnList snq) {
}
}
-const char *Snail::_comTxt[] = {
+const char *Snail::_comText[] = {
"LABEL", "PAUSE", "WAIT", "LEVEL", "HIDE",
"SAY", "INF", "TIME", "CAVE", "KILL",
"RSEQ", "SEQ", "SEND", "SWAP", "KEEP",
@@ -871,10 +871,10 @@ void CGEEngine::snFlash(bool on) {
debugC(1, kCGEDebugEngine, "CGEEngine::snFlash(%s)", on ? "true" : "false");
if (on) {
- Dac *pal = (Dac *) malloc(sizeof(Dac) * PAL_CNT);
+ Dac *pal = (Dac *) malloc(sizeof(Dac) * kPalCount);
if (pal) {
- memcpy(pal, Vga::_sysPal, PAL_SIZ);
- for (int i = 0; i < PAL_CNT; i++) {
+ memcpy(pal, Vga::_sysPal, kPalSize);
+ for (int i = 0; i < kPalCount; i++) {
register int c;
c = pal[i]._r << 1;
pal[i]._r = (c < 64) ? c : 63;
diff --git a/engines/cge/snail.h b/engines/cge/snail.h
index 2b488cd5b2..2d12963f2c 100644
--- a/engines/cge/snail.h
+++ b/engines/cge/snail.h
@@ -67,7 +67,7 @@ public:
bool _busy;
bool _textDelay;
uint32 _timerExpiry;
- static const char *_comTxt[];
+ static const char *_comText[];
bool _talkEnable;
Snail(CGEEngine *vm, bool turbo);
~Snail();
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 4a2df79f24..db44536267 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -73,25 +73,12 @@ uint16 Font::width(const char *text) {
return w;
}
-
-/*
-void Font::save() {
- CFILE f((const char *) _path, WRI);
- if (!f._error) {
- f.Write(_wid, WID_SIZ);
- if (!f._error)
- f.Write(_map, _pos[POS_SIZ - 1] + _wid[WID_SIZ - 1]);
- }
-}
-*/
-
-
-Talk::Talk(CGEEngine *vm, const char *tx, TextBoxStyle mode)
+Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode)
: Sprite(vm, NULL), _mode(mode), _vm(vm) {
_ts = NULL;
_flags._syst = true;
- update(tx);
+ update(text);
}
@@ -101,18 +88,6 @@ Talk::Talk(CGEEngine *vm)
_flags._syst = true;
}
-
-/*
-Talk::~Talk() {
- for (uint16 i = 0; i < ShpCnt; i++) {
- if (FP_SEG(_shpList[i]) != _DS) { // small model: always false
- delete _shpList[i];
- ShpList[i] = NULL;
- }
- }
-}
-*/
-
Font *Talk::_font;
void Talk::init() {
@@ -124,17 +99,18 @@ void Talk::deinit() {
}
-void Talk::update(const char *tx) {
+void Talk::update(const char *text) {
uint16 vmarg = (_mode) ? kTextVMargin : 0;
uint16 hmarg = (_mode) ? kTextHMargin : 0;
- uint16 mw = 0, mh, ln = vmarg;
+ uint16 mw = 0;
+ uint16 ln = vmarg;
const char *p;
uint8 *m;
if (!_ts) {
uint16 k = 2 * hmarg;
- mh = 2 * vmarg + kFontHigh;
- for (p = tx; *p; p++) {
+ uint16 mh = 2 * vmarg + kFontHigh;
+ for (p = text; *p; p++) {
if (*p == '|' || *p == '\n') {
mh += kFontHigh + kTextLineSpace;
if (k > mw)
@@ -146,19 +122,19 @@ void Talk::update(const char *tx) {
if (k > mw)
mw = k;
- _ts = new BMP_PTR[2];
+ _ts = new BitmapPtr[2];
_ts[0] = box(mw, mh);
_ts[1] = NULL;
}
m = _ts[0]->_m + ln * mw + hmarg;
- while (* tx) {
- if (*tx == '|' || *tx == '\n')
+ while (*text) {
+ if (*text == '|' || *text == '\n')
m = _ts[0]->_m + (ln += kFontHigh + kTextLineSpace) * mw + hmarg;
else {
- int cw = _font->_wid[(unsigned char)*tx], i;
- uint8 *f = _font->_map + _font->_pos[(unsigned char)*tx];
+ int cw = _font->_wid[(unsigned char)*text], i;
+ uint8 *f = _font->_map + _font->_pos[(unsigned char)*text];
for (i = 0; i < cw; i++) {
uint8 *pp = m;
uint16 n;
@@ -172,7 +148,7 @@ void Talk::update(const char *tx) {
m++;
}
}
- tx++;
+ text++;
}
_ts[0]->code();
setShapeList(_ts);
@@ -239,7 +215,7 @@ void Talk::putLine(int line, const char *text) {
// clear whole rectangle
assert((rsiz % lsiz) == 0);
- for (int planeCtr = 0; planeCtr < 4; ++planeCtr, p += psiz) {
+ for (int planeCtr = 0; planeCtr < 4; planeCtr++, p += psiz) {
for (byte *pDest = p; pDest < (p + (rsiz - lsiz)); pDest += lsiz)
Common::copy(p - lsiz, p, pDest);
}
@@ -273,9 +249,9 @@ void Talk::putLine(int line, const char *text) {
}
-InfoLine::InfoLine(CGEEngine *vm, uint16 w) : Talk(vm), _oldTxt(NULL), _vm(vm) {
+InfoLine::InfoLine(CGEEngine *vm, uint16 w) : Talk(vm), _oldText(NULL), _vm(vm) {
if (!_ts) {
- _ts = new BMP_PTR[2];
+ _ts = new BitmapPtr[2];
_ts[1] = NULL;
}
@@ -284,8 +260,8 @@ InfoLine::InfoLine(CGEEngine *vm, uint16 w) : Talk(vm), _oldTxt(NULL), _vm(vm) {
}
-void InfoLine::update(const char *tx) {
- if (tx != _oldTxt) {
+void InfoLine::update(const char *text) {
+ if (text != _oldText) {
uint16 w = _ts[0]->_w;
uint16 h = _ts[0]->_h;
uint8 *v = (uint8 *) _ts[0]->_v;
@@ -306,12 +282,12 @@ void InfoLine::update(const char *tx) {
}
// paint text line
- if (tx) {
+ if (text) {
uint8 *p = v + 2, * q = p + size;
- while (*tx) {
- uint16 cw = _font->_wid[(unsigned char)*tx];
- uint8 *fp = _font->_map + _font->_pos[(unsigned char)*tx];
+ while (*text) {
+ uint16 cw = _font->_wid[(unsigned char)*text];
+ uint8 *fp = _font->_map + _font->_pos[(unsigned char)*text];
for (uint16 i = 0; i < cw; i++) {
register uint16 b = fp[i];
@@ -324,10 +300,10 @@ void InfoLine::update(const char *tx) {
if (p >= q)
p = p - size + 1;
}
- tx++;
+ text++;
}
}
- _oldTxt = tx;
+ _oldText = text;
}
}
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
index d9c29261f6..71db57c887 100644
--- a/engines/cge/talk.h
+++ b/engines/cge/talk.h
@@ -66,10 +66,10 @@ public:
class Talk : public Sprite {
protected:
TextBoxStyle _mode;
- BMP_PTR *_ts;
+ BitmapPtr *_ts;
Bitmap *box(uint16 w, uint16 h);
public:
- Talk(CGEEngine *vm, const char *tx, TextBoxStyle mode);
+ Talk(CGEEngine *vm, const char *text, TextBoxStyle mode);
Talk(CGEEngine *vm);
//~TALK();
@@ -77,7 +77,7 @@ public:
static void init();
static void deinit();
- virtual void update(const char *tx);
+ virtual void update(const char *text);
virtual void update() {}
void putLine(int line, const char *text);
private:
@@ -85,10 +85,10 @@ private:
};
class InfoLine : public Talk {
- const char *_oldTxt;
+ const char *_oldText;
public:
InfoLine(CGEEngine *vm, uint16 wid);
- void update(const char *tx);
+ void update(const char *text);
private:
CGEEngine *_vm;
};
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index f688546810..485ba00ad1 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -40,13 +40,13 @@ Talk *_talk = NULL;
Text::Text(CGEEngine *vm, const char *fname, int size) : _vm(vm) {
_cache = new Han[size];
- mergeExt(_fileName, fname, SAY_EXT);
+ mergeExt(_fileName, fname, kSayExt);
if (!INI_FILE::exist(_fileName))
error("No talk (%s)\n", _fileName);
for (_size = 0; _size < size; _size++) {
_cache[_size]._ref = 0;
- _cache[_size]._txt = NULL;
+ _cache[_size]._text = NULL;
}
}
@@ -62,8 +62,8 @@ void Text::clear(int from, int upto) {
for (p = _cache, q = p + _size; p < q; p++) {
if (p->_ref && p->_ref >= from && p->_ref < upto) {
p->_ref = 0;
- delete[] p->_txt;
- p->_txt = NULL;
+ delete[] p->_text;
+ p->_text = NULL;
}
}
}
@@ -105,8 +105,8 @@ void Text::preload(int from, int upto) {
p = &_cache[find(ref)];
if (p < CacheLim) {
- delete[] p->_txt;
- p->_txt = NULL;
+ delete[] p->_text;
+ p->_text = NULL;
} else
p = &_cache[find(0)];
if (p >= CacheLim)
@@ -114,10 +114,10 @@ void Text::preload(int from, int upto) {
s += strlen(s);
if (s < line + n)
++s;
- if ((p->_txt = new char[strlen(s) + 1]) == NULL)
+ if ((p->_text = new char[strlen(s) + 1]) == NULL)
break;
p->_ref = ref;
- strcpy(p->_txt, s);
+ strcpy(p->_text, s);
}
}
}
@@ -151,9 +151,9 @@ char *Text::load(int idx, int ref) {
if (s < line + n)
++s;
p->_ref = ref;
- if ((p->_txt = new char[strlen(s) + 1]) == NULL)
+ if ((p->_text = new char[strlen(s) + 1]) == NULL)
return NULL;
- return strcpy(p->_txt, s);
+ return strcpy(p->_text, s);
}
}
return NULL;
@@ -163,10 +163,10 @@ char *Text::load(int idx, int ref) {
char *Text::getText(int ref) {
int i;
if ((i = find(ref)) < _size)
- return _cache[i]._txt;
+ return _cache[i]._text;
if ((i = find(0)) >= _size) {
- clear(SYSTXT_MAX); // clear non-system
+ clear(kSysTextMax); // clear non-system
if ((i = find(0)) >= _size) {
clear(); // clear all
i = 0;
@@ -176,9 +176,9 @@ char *Text::getText(int ref) {
}
-void Text::say(const char *txt, Sprite *spr) {
+void Text::say(const char *text, Sprite *spr) {
killText();
- _talk = new Talk(_vm, txt, kTBRound);
+ _talk = new Talk(_vm, text, kTBRound);
if (_talk) {
bool east = spr->_flags._east;
int x = (east) ? (spr->_x + spr->_w - 2) : (spr->_x + 2);
@@ -217,11 +217,11 @@ void Text::say(const char *txt, Sprite *spr) {
}
}
-void CGEEngine::inf(const char *txt) {
- debugC(1, kCGEDebugEngine, "CGEEngine::inf(%s)", txt);
+void CGEEngine::inf(const char *text) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::inf(%s)", text);
killText();
- _talk = new Talk(this, txt, kTBRect);
+ _talk = new Talk(this, text, kTBRect);
if (_talk) {
_talk->_flags._kill = true;
_talk->_flags._bDel = true;
diff --git a/engines/cge/text.h b/engines/cge/text.h
index 196bfc4edb..6ed5b32b22 100644
--- a/engines/cge/text.h
+++ b/engines/cge/text.h
@@ -33,11 +33,9 @@
namespace CGE {
-#ifndef SYSTXT_MAX
-#define SYSTXT_MAX 1000
-#endif
+#define kSysTextMax 1000
-#define SAY_EXT ".SAY"
+#define kSayExt ".SAY"
#define NOT_VGA_TEXT 90
#define BAD_CHIP_TEXT 91
@@ -54,7 +52,7 @@ namespace CGE {
class Text {
struct Han {
int _ref;
- char *_txt;
+ char *_text;
} *_cache;
int _size;
char _fileName[kPathMax];
@@ -66,7 +64,7 @@ public:
void clear(int from = 1, int upto = 0x7FFF);
void preload(int from = 1, int upto = 0x7FFF);
char *getText(int ref);
- void say(const char *txt, Sprite *spr);
+ void say(const char *text, Sprite *spr);
private:
CGEEngine *_vm;
};
@@ -74,9 +72,9 @@ private:
extern Talk *_talk;
extern Text *_text;
-void say(const char *txt, Sprite *spr);
+void say(const char *text, Sprite *spr);
void sayTime(Sprite *spr);
-void inf(const char *txt);
+void inf(const char *text);
void killText();
} // End of namespace CGE
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 9b30e02e4d..cc715da03c 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -211,7 +211,7 @@ Sprite *locate(int ref) {
return (spr) ? spr : _vga->_spareQ->locate(ref);
}
-Sprite::Sprite(CGEEngine *vm, BMP_PTR *shpP)
+Sprite::Sprite(CGEEngine *vm, BitmapPtr *shpP)
: _x(0), _y(0), _z(0), _nearPtr(0), _takePtr(0),
_next(NULL), _prev(NULL), _seqPtr(NO_SEQ), _time(0), //Delay(0),
_ext(NULL), _ref(-1), _cave(0), _vm(vm) {
@@ -234,7 +234,7 @@ Sprite::~Sprite() {
}
-BMP_PTR Sprite::shp() {
+BitmapPtr Sprite::shp() {
register SprExt *e = _ext;
if (e)
if (e->_seq) {
@@ -252,17 +252,17 @@ BMP_PTR Sprite::shp() {
}
-BMP_PTR *Sprite::setShapeList(BMP_PTR *shpP) {
- BMP_PTR *r = (_ext) ? _ext->_shpList : NULL;
+BitmapPtr *Sprite::setShapeList(BitmapPtr *shpP) {
+ BitmapPtr *r = (_ext) ? _ext->_shpList : NULL;
_shpCnt = 0;
_w = 0;
_h = 0;
if (shpP) {
- BMP_PTR *p;
+ BitmapPtr *p;
for (p = shpP; *p; p++) {
- BMP_PTR b = (*p); // ->Code();
+ BitmapPtr b = (*p); // ->Code();
if (b->_w > _w)
_w = b->_w;
if (b->_h > _h)
@@ -280,7 +280,7 @@ BMP_PTR *Sprite::setShapeList(BMP_PTR *shpP) {
void Sprite::moveShapes(uint8 *buf) {
- BMP_PTR *p;
+ BitmapPtr *p;
for (p = _ext->_shpList; *p; p++) {
buf += (*p)->moveVmap(buf);
}
@@ -336,16 +336,16 @@ Snail::Com *Sprite::snList(SnList type) {
}
-void Sprite::setName(char *n) {
+void Sprite::setName(char *name) {
if (_ext) {
if (_ext->_name) {
delete[] _ext->_name;
_ext->_name = NULL;
}
- if (n) {
- _ext->_name = new char[strlen(n) + 1];
+ if (name) {
+ _ext->_name = new char[strlen(name) + 1];
assert(_ext->_name != NULL);
- strcpy(_ext->_name, n);
+ strcpy(_ext->_name, name);
}
}
}
@@ -358,7 +358,7 @@ Sprite *Sprite::expand() {
if (*_file) {
static const char *Comd[] = { "Name", "Phase", "Seq", "Near", "Take", NULL };
char line[kLineMax], fname[kPathMax];
- BMP_PTR *shplist = new BMP_PTR[_shpCnt + 1];
+ BitmapPtr *shplist = new BitmapPtr[_shpCnt + 1];
Seq *seq = NULL;
int shpcnt = 0,
seqcnt = 0,
@@ -419,7 +419,7 @@ Sprite *Sprite::expand() {
nea = (Snail::Com *) realloc(nea, (neacnt + 1) * sizeof(*nea));
assert(nea != NULL);
Snail::Com *c = &nea[neacnt++];
- if ((c->_com = (SnCom)takeEnum(Snail::_comTxt, strtok(NULL, " \t,;/"))) < 0)
+ if ((c->_com = (SnCom)takeEnum(Snail::_comText, strtok(NULL, " \t,;/"))) < 0)
error("Bad NEAR in %d [%s]", lcnt, fname);
c->_ref = atoi(strtok(NULL, " \t,;/"));
c->_val = atoi(strtok(NULL, " \t,;/"));
@@ -432,7 +432,7 @@ Sprite *Sprite::expand() {
tak = (Snail::Com *) realloc(tak, (takcnt + 1) * sizeof(*tak));
assert(tak != NULL);
Snail::Com *c = &tak[takcnt++];
- if ((c->_com = (SnCom)takeEnum(Snail::_comTxt, strtok(NULL, " \t,;/"))) < 0)
+ if ((c->_com = (SnCom)takeEnum(Snail::_comText, strtok(NULL, " \t,;/"))) < 0)
error("Bad NEAR in %d [%s]", lcnt, fname);
c->_ref = atoi(strtok(NULL, " \t,;/"));
c->_val = atoi(strtok(NULL, " \t,;/"));
@@ -528,7 +528,7 @@ void Sprite::tick() {
void Sprite::makeXlat(uint8 *x) {
if (_ext) {
- BMP_PTR *b;
+ BitmapPtr *b;
if (_flags._xlat)
killXlat();
@@ -541,7 +541,7 @@ void Sprite::makeXlat(uint8 *x) {
void Sprite::killXlat() {
if (_flags._xlat && _ext) {
- BMP_PTR *b;
+ BitmapPtr *b;
uint8 *m = (*_ext->_shpList)->_m;
free(m);
@@ -616,10 +616,10 @@ void Sprite::hide() {
}
-BMP_PTR Sprite::ghost() {
+BitmapPtr Sprite::ghost() {
register SprExt *e = _ext;
if (e->_b1) {
- BMP_PTR bmp = new Bitmap(0, 0, (uint8 *)NULL);
+ BitmapPtr bmp = new Bitmap(0, 0, (uint8 *)NULL);
assert(bmp != NULL);
bmp->_w = e->_b1->_w;
bmp->_h = e->_b1->_h;
@@ -785,37 +785,35 @@ Graphics::Surface *Vga::_page[4];
Dac *Vga::_sysPal;
void Vga::init() {
- for (int idx = 0; idx < 4; ++idx) {
+ for (int idx = 0; idx < 4; idx++) {
_page[idx] = new Graphics::Surface();
_page[idx]->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
}
- _sysPal = new Dac[PAL_CNT];
+ _sysPal = new Dac[kPalCount];
}
void Vga::deinit() {
- for (int idx = 0; idx < 4; ++idx) {
+ for (int idx = 0; idx < 4; idx++) {
_page[idx]->free();
delete _page[idx];
}
-
delete[] _sysPal;
}
Vga::Vga(int mode)
: _frmCnt(0), _oldMode(0), _oldScreen(NULL), _statAdr(VGAST1_),
- _msg(NULL), _nam(NULL), _setPal(false), _mono(0) {
+ _msg(NULL), _name(NULL), _setPal(false), _mono(0) {
_oldColors = NULL;
_newColors = NULL;
_showQ = new Queue(true);
_spareQ = new Queue(false);
bool std = true;
- int i;
- for (i = 10; i < 20; i++) {
- char *txt = _text->getText(i);
- if (txt) {
- debugN("%s", txt);
+ for (int i = 10; i < 20; i++) {
+ char *text = _text->getText(i);
+ if (text) {
+ debugN("%s", text);
std = false;
}
}
@@ -826,8 +824,8 @@ Vga::Vga(int mode)
setStatAdr();
if (_statAdr != VGAST1_)
_mono++;
- _oldColors = (Dac *) malloc(sizeof(Dac) * PAL_CNT);
- _newColors = (Dac *) malloc(sizeof(Dac) * PAL_CNT);
+ _oldColors = (Dac *) malloc(sizeof(Dac) * kPalCount);
+ _newColors = (Dac *) malloc(sizeof(Dac) * kPalCount);
_oldScreen = SaveScreen();
getColors(_oldColors);
sunset();
@@ -853,8 +851,8 @@ Vga::~Vga() {
free(_newColors);
if (_msg)
buffer = Common::String(_msg);
- if (_nam)
- buffer = buffer + " [" + _nam + "]";
+ if (_name)
+ buffer = buffer + " [" + _name + "]";
debugN("%s", buffer.c_str());
@@ -936,14 +934,14 @@ int Vga::setMode(int mode) {
void Vga::getColors(Dac *tab) {
- byte palData[PAL_SIZ];
- g_system->getPaletteManager()->grabPalette(palData, 0, PAL_CNT);
+ byte palData[kPalSize];
+ g_system->getPaletteManager()->grabPalette(palData, 0, kPalCount);
palToDac(palData, tab);
}
void Vga::palToDac(const byte *palData, Dac *tab) {
const byte *colP = palData;
- for (int idx = 0; idx < PAL_CNT; ++idx, colP += 3) {
+ for (int idx = 0; idx < kPalCount; idx++, colP += 3) {
tab[idx]._r = *colP >> 2;
tab[idx]._g = *(colP + 1) >> 2;
tab[idx]._b = *(colP + 2) >> 2;
@@ -951,7 +949,7 @@ void Vga::palToDac(const byte *palData, Dac *tab) {
}
void Vga::dacToPal(const Dac *tab, byte *palData) {
- for (int idx = 0; idx < PAL_CNT; ++idx, palData += 3) {
+ for (int idx = 0; idx < kPalCount; idx++, palData += 3) {
*palData = tab[idx]._r << 2;
*(palData + 1) = tab[idx]._g << 2;
*(palData + 2) = tab[idx]._b << 2;
@@ -960,7 +958,7 @@ void Vga::dacToPal(const Dac *tab, byte *palData) {
void Vga::setColors(Dac *tab, int lum) {
Dac *palP = tab, *destP = _newColors;
- for (int idx = 0; idx < PAL_CNT; ++idx, ++palP, ++destP) {
+ for (int idx = 0; idx < kPalCount; idx++, palP++, destP++) {
destP->_r = (palP->_r * lum) >> 6;
destP->_g = (palP->_g * lum) >> 6;
destP->_b = (palP->_b * lum) >> 6;
@@ -968,7 +966,7 @@ void Vga::setColors(Dac *tab, int lum) {
if (_mono) {
destP = _newColors;
- for (int idx = 0; idx < PAL_CNT; ++idx, ++destP) {
+ for (int idx = 0; idx < kPalCount; idx++, destP++) {
// Form a greyscalce colour from 30% R, 59% G, 11% B
uint8 intensity = (((int)destP->_r * 77) + ((int)destP->_g * 151) + ((int)destP->_b * 28)) >> 8;
destP->_r = intensity;
@@ -982,7 +980,7 @@ void Vga::setColors(Dac *tab, int lum) {
void Vga::setColors() {
- memset(_newColors, 0, PAL_SIZ);
+ memset(_newColors, 0, kPalSize);
updateColors();
}
@@ -1021,7 +1019,7 @@ void Vga::show() {
void Vga::updateColors() {
- byte palData[PAL_SIZ];
+ byte palData[kPalSize];
dacToPal(_newColors, palData);
g_system->getPaletteManager()->setPalette(palData, 0, 256);
}
@@ -1041,7 +1039,7 @@ void Vga::update() {
void Vga::clear(uint8 color) {
- for (int paneNum = 0; paneNum < 4; ++paneNum)
+ for (int paneNum = 0; paneNum < 4; paneNum++)
_page[paneNum]->fillRect(Common::Rect(0, 0, kScrWidth, kScrHeight), color);
}
@@ -1062,7 +1060,7 @@ void Bitmap::xShow(int16 x, int16 y) {
// Loop through processing data for each plane. The game originally ran in plane mapped mode, where a
// given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data
// must be decompressed and inserted into the surface
- for (int planeCtr = 0; planeCtr < 4; ++planeCtr) {
+ for (int planeCtr = 0; planeCtr < 4; planeCtr++) {
byte *destP = (byte *)Vga::_page[1]->getBasePtr(x + planeCtr, y);
for (;;) {
@@ -1079,7 +1077,7 @@ void Bitmap::xShow(int16 x, int16 y) {
assert(destP < destEndP);
if (cmd == 2)
- ++srcP;
+ srcP++;
else if (cmd == 3)
srcP += count;
@@ -1114,7 +1112,7 @@ void Bitmap::show(int16 x, int16 y) {
// Loop through processing data for each plane. The game originally ran in plane mapped mode, where a
// given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data
// must be decompressed and inserted into the surface
- for (int planeCtr = 0; planeCtr < 4; ++planeCtr) {
+ for (int planeCtr = 0; planeCtr < 4; planeCtr++) {
byte *destP = (byte *)Vga::_page[1]->getBasePtr(x + planeCtr, y);
for (;;) {
@@ -1152,7 +1150,7 @@ void Bitmap::show(int16 x, int16 y) {
}
if (cmd == 2)
- ++srcP;
+ srcP++;
}
}
/*
@@ -1184,7 +1182,7 @@ void Bitmap::hide(int16 x, int16 y) {
HorizLine::HorizLine(CGEEngine *vm): Sprite(vm, NULL) {
// Set the sprite list
- BMP_PTR *HL = new BMP_PTR[2];
+ BitmapPtr *HL = new BitmapPtr[2];
HL[0] = new Bitmap("HLINE", true);
HL[1] = NULL;
@@ -1193,7 +1191,7 @@ HorizLine::HorizLine(CGEEngine *vm): Sprite(vm, NULL) {
CavLight::CavLight(CGEEngine *vm): Sprite(vm, NULL) {
// Set the sprite list
- BMP_PTR *PR = new BMP_PTR[2];
+ BitmapPtr *PR = new BitmapPtr[2];
PR[0] = new Bitmap("PRESS", true);
PR[1] = NULL;
@@ -1202,7 +1200,7 @@ CavLight::CavLight(CGEEngine *vm): Sprite(vm, NULL) {
Spike::Spike(CGEEngine *vm): Sprite(vm, NULL) {
// Set the sprite list
- BMP_PTR *SP = new BMP_PTR[3];
+ BitmapPtr *SP = new BitmapPtr[3];
SP[0] = new Bitmap("SPK_L", true);
SP[1] = new Bitmap("SPK_R", true);
SP[2] = NULL;
@@ -1212,7 +1210,7 @@ Spike::Spike(CGEEngine *vm): Sprite(vm, NULL) {
PocLight::PocLight(CGEEngine *vm): Sprite(vm, NULL) {
// Set the sprite list
- BMP_PTR *LI = new BMP_PTR[5];
+ BitmapPtr *LI = new BitmapPtr[5];
LI[0] = new Bitmap("LITE0", true);
LI[1] = new Bitmap("LITE1", true);
LI[2] = new Bitmap("LITE2", true);
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index 15da63efbc..f72d4c693d 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -99,33 +99,32 @@ extern Seq _seq2[];
//extern SEQ * Compass[];
//extern SEQ TurnToS[];
-#define PAL_CNT 256
-#define PAL_SIZ (PAL_CNT * 3)
+#define kPalCount 256
+#define kPalSize (kPalCount * 3)
+
#define VGAATR_ 0x3C0
-#define VGAMIw_ 0x3C0
#define VGASEQ_ 0x3C4
-#define VGAMIr_ 0x3CC
#define VGAGRA_ 0x3CE
#define VGACRT_ 0x3D4
#define VGAST1_ 0x3DA
#define VGAATR (VGAATR_ & 0xFF)
-#define VGAMIw (VGAMIw_ & 0xFF)
#define VGASEQ (VGASEQ_ & 0xFF)
-#define VGAMIr (VGAMIr_ & 0xFF)
#define VGAGRA (VGAGRA_ & 0xFF)
#define VGACRT (VGACRT_ & 0xFF)
-#define VGAST1 (VGAST1_ & 0xFF)
-
class SprExt {
public:
- int _x0, _y0;
- int _x1, _y1;
- BMP_PTR _b0, _b1;
- BMP_PTR *_shpList;
+ int _x0;
+ int _y0;
+ int _x1;
+ int _y1;
+ BitmapPtr _b0;
+ BitmapPtr _b1;
+ BitmapPtr *_shpList;
Seq *_seq;
char *_name;
- Snail::Com *_near, *_take;
+ Snail::Com *_near;
+ Snail::Com *_take;
SprExt() :
_x0(0), _y0(0),
_x1(0), _y1(0),
@@ -179,15 +178,16 @@ public:
inline bool active() {
return _ext != NULL;
}
- Sprite(CGEEngine *vm, BMP_PTR *shp);
+
+ Sprite(CGEEngine *vm, BitmapPtr *shp);
virtual ~Sprite();
- BMP_PTR shp();
- BMP_PTR *setShapeList(BMP_PTR *shp);
+ BitmapPtr shp();
+ BitmapPtr *setShapeList(BitmapPtr *shp);
void moveShapes(uint8 *buf);
Sprite *expand();
Sprite *contract();
Sprite *backShow(bool fast = false);
- void setName(char *n);
+ void setName(char *name);
inline char *name() {
return (_ext) ? _ext->_name : NULL;
}
@@ -195,7 +195,7 @@ public:
void center();
void show();
void hide();
- BMP_PTR ghost();
+ BitmapPtr ghost();
void show(uint16 pg);
void makeXlat(uint8 *x);
void killXlat();
@@ -243,7 +243,7 @@ class Vga {
Dac *_oldColors;
Dac *_newColors;
const char *_msg;
- const char *_nam;
+ const char *_name;
int setMode(int mode);
void updateColors();
diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp
index 934bd6299d..e8aa899583 100644
--- a/engines/cge/vmenu.cpp
+++ b/engines/cge/vmenu.cpp
@@ -48,7 +48,7 @@ MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) {
p2 -= w;
}
- _ts = new BMP_PTR[2];
+ _ts = new BitmapPtr[2];
_ts[0] = new Bitmap(w, h, p);
_ts[1] = NULL;
setShapeList(_ts);
diff --git a/engines/cge/walk.cpp b/engines/cge/walk.cpp
index e2c62513dd..a9eeb6db8e 100644
--- a/engines/cge/walk.cpp
+++ b/engines/cge/walk.cpp
@@ -32,7 +32,7 @@ namespace CGE {
Walk *_hero;
-uint8 Cluster::_map[MAP_ZCNT][MAP_XCNT];
+uint8 Cluster::_map[kMapZCnt][kMapXCnt];
CGEEngine *Cluster::_vm;
void Cluster::init(CGEEngine *vm) {
@@ -44,22 +44,22 @@ uint8 &Cluster::cell() {
}
bool Cluster::isValid() const {
- return (_a >= 0) && (_a < MAP_XCNT) && (_b >= 0) && (_b < MAP_ZCNT);
+ return (_a >= 0) && (_a < kMapXCnt) && (_b >= 0) && (_b < kMapZCnt);
}
bool Cluster::chkBar() const {
- assert(_vm->_now <= _vm->CAVE_MAX);
+ assert(_vm->_now <= _vm->_caveMax);
return (_a == _vm->_barriers[_vm->_now]._horz) && (_b == _vm->_barriers[_vm->_now]._vert);
}
Cluster XZ(int x, int y) {
- if (y < MAP_TOP)
- y = MAP_TOP;
+ if (y < kMapTop)
+ y = kMapTop;
- if (y > MAP_TOP + MAP_HIG - MAP_ZGRID)
- y = MAP_TOP + MAP_HIG - MAP_ZGRID;
+ if (y > kMapTop + kMapHig - kMapGridZ)
+ y = kMapTop + kMapHig - kMapGridZ;
- return Cluster(x / MAP_XGRID, (y - MAP_TOP) / MAP_ZGRID);
+ return Cluster(x / kMapGridX, (y - kMapTop) / kMapGridZ);
}
@@ -69,8 +69,8 @@ Cluster XZ(Couple xy) {
return XZ(x, y);
}
-Walk::Walk(CGEEngine *vm, BMP_PTR *shpl)
- : Sprite(vm, shpl), Dir(NO_DIR), _tracePtr(-1), _level(0), _vm(vm) {
+Walk::Walk(CGEEngine *vm, BitmapPtr *shpl)
+ : Sprite(vm, shpl), _dir(kDirNone), _tracePtr(-1), _level(0), _vm(vm) {
}
@@ -80,7 +80,7 @@ void Walk::tick() {
_here = XZ(_x + _w / 2, _y + _h);
- if (Dir != NO_DIR) {
+ if (_dir != kDirNone) {
Sprite *spr;
_sys->funTouch();
for (spr = _vga->_showQ->first(); spr; spr = spr->_next) {
@@ -104,14 +104,14 @@ void Walk::tick() {
} else {
signed char dx, dz;
(_trace[_tracePtr] - _here).split(dx, dz);
- DIR d = (dx) ? ((dx > 0) ? EE : WW) : ((dz > 0) ? SS : NN);
+ Dir d = (dx) ? ((dx > 0) ? kDirEast : kDirWest) : ((dz > 0) ? kDirSouth : kDirNorth);
turn(d);
}
}
step();
- if ((Dir == WW && _x <= 0) ||
- (Dir == EE && _x + _w >= kScrWidth) ||
- (Dir == SS && _y + _w >= kWorldHeight - 2))
+ if ((_dir == kDirWest && _x <= 0) ||
+ (_dir == kDirEast && _x + _w >= kScrWidth) ||
+ (_dir == kDirSouth && _y + _w >= kWorldHeight - 2))
park();
else {
signed char x; // dummy var
@@ -130,7 +130,7 @@ int Walk::distance(Sprite *spr) {
if (dx < 0)
dx = 0;
- dx /= MAP_XGRID;
+ dx /= kMapGridX;
dz = spr->_z - _z;
if (dz < 0)
dz = - dz;
@@ -143,22 +143,22 @@ int Walk::distance(Sprite *spr) {
}
-void Walk::turn(DIR d) {
- DIR dir = (Dir == NO_DIR) ? SS : Dir;
- if (d != Dir) {
+void Walk::turn(Dir d) {
+ Dir dir = (_dir == kDirNone) ? kDirSouth : _dir;
+ if (d != _dir) {
step((d == dir) ? (1 + dir + dir) : (9 + 4 * dir + d));
- Dir = d;
+ _dir = d;
}
}
void Walk::park() {
if (_time == 0)
- ++_time;
+ _time++;
- if (Dir != NO_DIR) {
- step(9 + 4 * Dir + Dir);
- Dir = NO_DIR;
+ if (_dir != kDirNone) {
+ step(9 + 4 * _dir + _dir);
+ _dir = kDirNone;
_tracePtr = -1;
}
}
@@ -166,7 +166,7 @@ void Walk::park() {
void Walk::findWay(Cluster c) {
if (c != _here) {
- for (_findLevel = 1; _findLevel <= MAX_FIND_LEVEL; _findLevel++) {
+ for (_findLevel = 1; _findLevel <= kMaxFindLevel; _findLevel++) {
signed char x, z;
_here.split(x, z);
_target = Couple(x, z);
@@ -175,7 +175,7 @@ void Walk::findWay(Cluster c) {
if (find1Way(Cluster(x, z)))
break;
}
- _tracePtr = (_findLevel > MAX_FIND_LEVEL) ? -1 : (_findLevel - 1);
+ _tracePtr = (_findLevel > kMaxFindLevel) ? -1 : (_findLevel - 1);
if (_tracePtr < 0)
noWay();
_time = 1;
@@ -191,8 +191,8 @@ void Walk::findWay(Sprite *spr) {
x += spr->_w + _w / 2 - kWalkSide;
else
x -= _w / 2 - kWalkSide;
- findWay(Cluster((x / MAP_XGRID),
- ((z < MAP_ZCNT - kDistMax) ? (z + 1)
+ findWay(Cluster((x / kMapGridX),
+ ((z < kMapZCnt - kDistMax) ? (z + 1)
: (z - 1))));
}
}
@@ -250,7 +250,7 @@ bool Walk::find1Way(Cluster c) {
// Loop through each direction
- for (int i = 0; i < tabLen; ++i) {
+ for (int i = 0; i < tabLen; i++) {
// Reset to starting position
c = start;
diff --git a/engines/cge/walk.h b/engines/cge/walk.h
index 15ea9ee0ce..115cb4924a 100644
--- a/engines/cge/walk.h
+++ b/engines/cge/walk.h
@@ -34,13 +34,15 @@
namespace CGE {
-#define MAP_XCNT 40
-#define MAP_ZCNT 20
-#define MAP_TOP 80
-#define MAP_HIG 80
-#define MAP_XGRID (kScrWidth / MAP_XCNT)
-#define MAP_ZGRID (MAP_HIG / MAP_ZCNT)
-#define MAX_FIND_LEVEL 3
+#define kMapXCnt 40
+#define kMapZCnt 20
+#define kMapTop 80
+#define kMapHig 80
+#define kMapGridX (kScrWidth / kMapXCnt)
+#define kMapGridZ (kMapHig / kMapZCnt)
+#define kMaxFindLevel 3
+
+enum Dir { kDirNone = -1, kDirNorth, kDirEast, kDirSouth, kDirWest };
class Couple {
protected:
@@ -83,7 +85,7 @@ public:
class Cluster : public Couple {
public:
- static uint8 _map[MAP_ZCNT][MAP_XCNT];
+ static uint8 _map[kMapZCnt][kMapXCnt];
static CGEEngine *_vm;
static void init(CGEEngine *vm);
@@ -106,15 +108,15 @@ public:
int _level;
int _findLevel;
Couple _target;
- Cluster _trace[MAX_FIND_LEVEL];
+ Cluster _trace[kMaxFindLevel];
- enum DIR { NO_DIR = -1, NN, EE, SS, WW } Dir;
- Walk(CGEEngine *vm, BMP_PTR *shpl);
+ Dir _dir;
+ Walk(CGEEngine *vm, BitmapPtr *shpl);
void tick();
void findWay(Cluster c);
void findWay(Sprite *spr);
int distance(Sprite *spr);
- void turn(DIR d);
+ void turn(Dir d);
void park();
bool lower(Sprite *spr);
void reach(Sprite *spr, int mode = -1);
diff --git a/engines/cge/wav.h b/engines/cge/wav.h
index 739e102959..bd9fc96b0a 100644
--- a/engines/cge/wav.h
+++ b/engines/cge/wav.h
@@ -41,20 +41,20 @@ typedef char FourCC[4]; // Four-character code
class ChunkId { // Chunk type identifier
union {
- FourCC _tx;
+ FourCC _text;
uint32 _id;
};
protected:
static XFile *ckFile;
public:
- ChunkId(FourCC t) {
- memcpy(_tx, t, sizeof(_tx));
+ ChunkId(FourCC text) {
+ memcpy(_text, text, sizeof(_text));
}
ChunkId(uint32 d) {
_id = d;
}
ChunkId(XFile *xf) {
- (ckFile = xf)->read(_tx, sizeof(_tx));
+ (ckFile = xf)->read(_text, sizeof(_text));
}
bool operator !=(ChunkId &X) {
return _id != X._id;
@@ -116,7 +116,7 @@ public:
class DataCk : public CkHea {
- bool _e;
+ bool _ef;
uint8 *_buf;
public:
DataCk(CkHea &hea);