aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2011-07-18 18:05:57 +0200
committerStrangerke2011-07-18 18:05:57 +0200
commit8aa4f739af014303cc6a0fb90f13c22a1f77d33f (patch)
tree3d19b17129f546f18030ca3a1f7f81d91dc0f228
parente1df646ace3f0b487ef810a5489c3f0c2090da71 (diff)
downloadscummvm-rg350-8aa4f739af014303cc6a0fb90f13c22a1f77d33f.tar.gz
scummvm-rg350-8aa4f739af014303cc6a0fb90f13c22a1f77d33f.tar.bz2
scummvm-rg350-8aa4f739af014303cc6a0fb90f13c22a1f77d33f.zip
CGE: Add debug channels (WIP)
-rw-r--r--engines/cge/bitmap.cpp54
-rw-r--r--engines/cge/bitmap.h4
-rw-r--r--engines/cge/btfile.cpp22
-rw-r--r--engines/cge/cfile.cpp58
-rw-r--r--engines/cge/cfile.h4
-rw-r--r--engines/cge/cge.cpp10
-rw-r--r--engines/cge/cge.h6
-rw-r--r--engines/cge/cge_main.cpp38
-rw-r--r--engines/cge/general.cpp3
-rw-r--r--engines/cge/vga13h.cpp8
-rw-r--r--engines/cge/vol.cpp20
-rw-r--r--engines/cge/vol.h4
12 files changed, 177 insertions, 54 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 8474924366..f280f61e3e 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -32,6 +32,8 @@
#include "cge/cfile.h"
#include "cge/vga13h.h"
#include "common/system.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
namespace CGE {
@@ -47,6 +49,8 @@ void Bitmap::deinit() {
#pragma argsused
Bitmap::Bitmap(const char *fname, bool rem) : _m(NULL), _v(NULL), _map(0) {
+ debugC(1, kDebugBitmap, "Bitmap::Bitmap(%s, %s)", fname, rem ? "true" : "false");
+
char pat[MAXPATH];
forceExt(pat, fname, ".VBM");
@@ -79,6 +83,7 @@ Bitmap::Bitmap(const char *fname, bool rem) : _m(NULL), _v(NULL), _map(0) {
Bitmap::Bitmap(uint16 w, uint16 h, uint8 *map) : _w(w), _h(h), _m(map), _v(NULL), _map(0) {
+ debugC(1, kDebugBitmap, "Bitmap::Bitmap(%d, %d, map)", w, h);
if (map)
code();
}
@@ -92,6 +97,8 @@ Bitmap::Bitmap(uint16 w, uint16 h, uint8 fill)
_h(h),
_m(NULL),
_map(0) {
+ debugC(1, kDebugBitmap, "Bitmap::Bitmap(%d, %d, %d)", w, h, fill);
+
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
@@ -116,20 +123,21 @@ Bitmap::Bitmap(uint16 w, uint16 h, uint8 fill)
Common::copy(v, v + psiz, destP);
HideDesc *b = (HideDesc *)(v + 4 * psiz);
- b->skip = (SCR_WID - _w) >> 2;
- b->hide = _w >> 2;
+ b->_skip = (SCR_WID - _w) >> 2;
+ b->_hide = _w >> 2;
// Replicate across the entire table
for (HideDesc *hdP = b + 1; hdP < (b + _h); ++hdP)
*hdP = *b;
- b->skip = 0; // fix the first entry
+ b->_skip = 0; // fix the first entry
_v = v;
_b = b;
}
Bitmap::Bitmap(const Bitmap &bmp) : _w(bmp._w), _h(bmp._h), _m(NULL), _v(NULL), _map(0) {
+ debugC(1, kDebugBitmap, "Bitmap::Bitmap(bmp)");
uint8 *v0 = bmp._v;
if (v0) {
uint16 vsiz = (uint8 *)(bmp._b) - (uint8 *)(v0);
@@ -144,12 +152,16 @@ Bitmap::Bitmap(const Bitmap &bmp) : _w(bmp._w), _h(bmp._h), _m(NULL), _v(NULL),
Bitmap::~Bitmap() {
+ debugC(6, kDebugBitmap, "Bitmap::~Bitmap()");
+
free(_m);
delete[] _v;
}
Bitmap &Bitmap::operator = (const Bitmap &bmp) {
+ debugC(1, kDebugBitmap, "&Bitmap::operator =");
+
uint8 *v0 = bmp._v;
_w = bmp._w;
_h = bmp._h;
@@ -172,6 +184,8 @@ Bitmap &Bitmap::operator = (const Bitmap &bmp) {
uint16 Bitmap::moveVmap(uint8 *buf) {
+ debugC(1, kDebugBitmap, "Bitmap::moveVmap(buf)");
+
if (_v) {
uint16 vsiz = (uint8 *)_b - (uint8 *)_v;
uint16 siz = vsiz + _h * sizeof(HideDesc);
@@ -185,6 +199,8 @@ uint16 Bitmap::moveVmap(uint8 *buf) {
BMP_PTR Bitmap::code() {
+ debugC(1, kDebugBitmap, "Bitmap::code()");
+
if (!_m)
return false;
@@ -202,8 +218,8 @@ BMP_PTR Bitmap::code() {
if (_v) { // 2nd pass - fill the hide table
for (i = 0; i < _h; i++) {
- _b[i].skip = 0xFFFF;
- _b[i].hide = 0x0000;
+ _b[i]._skip = 0xFFFF;
+ _b[i]._hide = 0x0000;
}
}
for (bpl = 0; bpl < 4; bpl++) { // once per each bitplane
@@ -217,11 +233,11 @@ BMP_PTR Bitmap::code() {
for (j = bpl; j < _w; j += 4) {
pix = bm[j];
if (_v && pix != TRANS) {
- if (j < _b[i].skip)
- _b[i].skip = j;
+ if (j < _b[i]._skip)
+ _b[i]._skip = j;
- if (j >= _b[i].hide)
- _b[i].hide = j + 1;
+ if (j >= _b[i]._hide)
+ _b[i]._hide = j + 1;
}
if ((pix == TRANS) != skip || cnt >= 0x3FF0) { // end of block
cnt |= (skip) ? SKP : CPY;
@@ -282,14 +298,14 @@ BMP_PTR Bitmap::code() {
}
cnt = 0;
for (i = 0; i < _h; i++) {
- if (_b[i].skip == 0xFFFF) { // whole line is skipped
- _b[i].skip = (cnt + SCR_WID) >> 2;
+ if (_b[i]._skip == 0xFFFF) { // whole line is skipped
+ _b[i]._skip = (cnt + SCR_WID) >> 2;
cnt = 0;
} else {
- 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;
+ 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;
}
}
@@ -299,6 +315,8 @@ BMP_PTR Bitmap::code() {
bool Bitmap::solidAt(int16 x, int16 y) {
+ debugC(6, kDebugBitmap, "Bitmap::solidAt(%d, %d)", x, y);
+
uint8 *m;
uint16 r, n, n0;
@@ -360,6 +378,8 @@ bool Bitmap::solidAt(int16 x, int16 y) {
bool Bitmap::saveVBM(XFile *f) {
+ debugC(1, kDebugBitmap, "Bitmap::saveVBM(f)");
+
uint16 p = (_pal != NULL),
n = ((uint16)(((uint8 *)_b) - _v)) + _h * sizeof(HideDesc);
if (f->_error == 0)
@@ -386,6 +406,8 @@ bool Bitmap::saveVBM(XFile *f) {
bool Bitmap::loadVBM(XFile *f) {
+ debugC(5, kDebugBitmap, "Bitmap::loadVBM(f)");
+
uint16 p = 0, n = 0;
if (f->_error == 0)
f->read((uint8 *)&p, sizeof(p));
@@ -427,6 +449,8 @@ bool Bitmap::loadVBM(XFile *f) {
}
bool Bitmap::loadBMP(XFile *f) {
+ debugC(1, kDebugBitmap, "Bitmap::loadBMP(f)");
+
struct {
char BM[2];
union { int16 len; int32 len_; };
diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h
index 3fdb673396..2728e27303 100644
--- a/engines/cge/bitmap.h
+++ b/engines/cge/bitmap.h
@@ -53,8 +53,8 @@ struct Bgr4 {
struct HideDesc {
- uint16 skip;
- uint16 hide;
+ uint16 _skip;
+ uint16 _hide;
};
#include "common/pack-end.h"
diff --git a/engines/cge/btfile.cpp b/engines/cge/btfile.cpp
index eda18ebaaf..68d3fe40e3 100644
--- a/engines/cge/btfile.cpp
+++ b/engines/cge/btfile.cpp
@@ -28,19 +28,16 @@
#include "cge/btfile.h"
#include "common/system.h"
#include "common/str.h"
+#include "cge/cge.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
namespace CGE {
-#ifndef BT_SIZE
-#define BT_SIZE K(1)
-#endif
-
-#ifndef BT_KEYLEN
-#define BT_KEYLEN 13
-#endif
-
BtFile::BtFile(const char *name, IOMODE mode, CRYPT *crpt)
: IoHand(name, mode, crpt) {
+ debugC(1, kDebugFile, "BtFile::BtFile(%s, %d, crpt)", name, mode);
+
for (int i = 0; i < BT_LEVELS; i++) {
_buff[i]._page = new BtPage;
_buff[i]._pgNo = BT_NONE;
@@ -53,6 +50,7 @@ BtFile::BtFile(const char *name, IOMODE mode, CRYPT *crpt)
BtFile::~BtFile() {
+ debugC(1, kDebugFile, "BtFile::~BtFile()");
for (int i = 0; i < BT_LEVELS; i++) {
putPage(i, false);
delete _buff[i]._page;
@@ -61,6 +59,8 @@ BtFile::~BtFile() {
void BtFile::putPage(int lev, bool hard) {
+ debugC(1, kDebugFile, "BtFile::putPage(%d, %s)", lev, hard ? "true" : "false");
+
if (hard || _buff[lev]._updt) {
seek(_buff[lev]._pgNo * sizeof(BtPage));
write((uint8 *) _buff[lev]._page, sizeof(BtPage));
@@ -70,6 +70,8 @@ void BtFile::putPage(int lev, bool hard) {
BtPage *BtFile::getPage(int lev, uint16 pgn) {
+ debugC(1, kDebugFile, "BtFile::getPage(%d, %d)", lev, pgn);
+
if (_buff[lev]._pgNo != pgn) {
int32 pos = pgn * sizeof(BtPage);
putPage(lev, false);
@@ -90,6 +92,8 @@ BtPage *BtFile::getPage(int lev, uint16 pgn) {
}
BtKeypack *BtFile::find(const char *key) {
+ debugC(1, kDebugFile, "BtFile::find(%s)", key);
+
int lev = 0;
uint16 nxt = BT_ROOT;
while (!_error) {
@@ -125,6 +129,8 @@ int keycomp(const void *k1, const void *k2) {
void BtFile::make(BtKeypack *keypack, uint16 count) {
+ debugC(1, kDebugFile, "BtFile::make(keypack, %d)", count);
+
#if BT_LEVELS != 2
#error This tiny BTREE implementation works with exactly 2 levels!
#endif
diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp
index f0a0ef3b8f..af29ec5df7 100644
--- a/engines/cge/cfile.cpp
+++ b/engines/cge/cfile.cpp
@@ -27,6 +27,9 @@
#include "cge/cfile.h"
#include "common/system.h"
+#include "cge/cge.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
namespace CGE {
@@ -35,6 +38,8 @@ IoBuf::IoBuf(IOMODE mode, CRYPT *crpt)
_bufMark(0),
_ptr(0),
_lim(0) {
+ debugC(1, kDebugFile, "IoBuf::IoBuf(%d, crpt)", mode);
+
_buff = farnew(uint8, IOBUF_SIZE);
if (_buff == NULL)
error("No core for I/O");
@@ -46,26 +51,34 @@ IoBuf::IoBuf(const char *name, IOMODE mode, CRYPT *crpt)
_bufMark(0),
_ptr(0),
_lim(0) {
+ debugC(1, kDebugFile, "IoBuf::IoBuf(%s, %d, crpt)", name, mode);
+
_buff = farnew(uint8, IOBUF_SIZE);
if (_buff == NULL)
error("No core for I/O [%s]", name);
}
IoBuf::~IoBuf() {
+ debugC(6, kDebugFile, "IoBuf::~IoBuf()");
+
if (_mode > REA)
- writeBuff();
+ writeBuf();
free(_buff);
}
-void IoBuf::readBuff() {
+void IoBuf::readBuf() {
+ debugC(4, kDebugFile, "IoBuf::readBuf()");
+
_bufMark = IoHand::mark();
_lim = IoHand::read(_buff, IOBUF_SIZE);
_ptr = 0;
}
-void IoBuf::writeBuff() {
+void IoBuf::writeBuf() {
+ debugC(4, kDebugFile, "IoBuf::writeBuf()");
+
if (_lim) {
IoHand::write(_buff, _lim);
_bufMark = IoHand::mark();
@@ -75,10 +88,12 @@ void IoBuf::writeBuff() {
uint16 IoBuf::read(void *buf, uint16 len) {
+ debugC(4, kDebugFile, "IoBuf::read(buf, %d)", len);
+
uint16 total = 0;
while (len) {
if (_ptr >= _lim)
- readBuff();
+ readBuf();
uint16 n = _lim - _ptr;
if (n) {
if (len < n)
@@ -96,11 +111,13 @@ uint16 IoBuf::read(void *buf, uint16 len) {
uint16 IoBuf::read(uint8 *buf) {
+ debugC(3, kDebugFile, "IoBuf::read(buf)");
+
uint16 total = 0;
while (total < LINE_MAX - 2) {
if (_ptr >= _lim)
- readBuff();
+ readBuf();
uint8 *p = _buff + _ptr;
uint16 n = _lim - _ptr;
if (n) {
@@ -126,7 +143,7 @@ uint16 IoBuf::read(uint8 *buf) {
*(buf++) = '\n';
total++;
if (_ptr >= _lim)
- readBuff();
+ readBuf();
if (_ptr < _lim)
if (_buff[_ptr] == '\n')
++_ptr;
@@ -141,6 +158,8 @@ uint16 IoBuf::read(uint8 *buf) {
uint16 IoBuf::write(void *buf, uint16 len) {
+ debugC(1, kDebugFile, "IoBuf::write(buf, %d)", len);
+
uint16 tot = 0;
while (len) {
uint16 n = IOBUF_SIZE - _lim;
@@ -153,13 +172,15 @@ uint16 IoBuf::write(void *buf, uint16 len) {
buf = (uint8 *)buf + n;
tot += n;
} else
- writeBuff();
+ writeBuf();
}
return tot;
}
uint16 IoBuf::write(uint8 *buf) {
+ debugC(1, kDebugFile, "IoBuf::write(buf)");
+
uint16 len = 0;
if (buf) {
len = strlen((const char *) buf);
@@ -178,8 +199,10 @@ uint16 IoBuf::write(uint8 *buf) {
int IoBuf::read() {
+ debugC(1, kDebugFile, "IoBuf::read()");
+
if (_ptr >= _lim) {
- readBuff();
+ readBuf();
if (_lim == 0)
return -1;
}
@@ -188,8 +211,10 @@ int IoBuf::read() {
void IoBuf::write(uint8 b) {
+ debugC(1, kDebugFile, "IoBuf::write(%d)", b);
+
if (_lim >= IOBUF_SIZE)
- writeBuff();
+ writeBuf();
_buff[_lim++] = b;
}
@@ -199,6 +224,7 @@ uint16 CFile::_maxLineLen = LINE_MAX;
CFile::CFile(const char *name, IOMODE mode, CRYPT *crpt)
: IoBuf(name, mode, crpt) {
+ debugC(1, kDebugFile, "CFile::CFile(%s, %d, crpt)", name, mode);
}
@@ -207,8 +233,10 @@ CFile::~CFile() {
void CFile::flush() {
+ debugC(1, kDebugFile, "CFile::flush()");
+
if (_mode > REA)
- writeBuff();
+ writeBuf();
else
_lim = 0;
@@ -222,17 +250,21 @@ void CFile::flush() {
long CFile::mark() {
+ debugC(5, kDebugFile, "CFile::mark()");
+
return _bufMark + ((_mode > REA) ? _lim : _ptr);
}
long CFile::seek(long pos) {
+ debugC(1, kDebugFile, "CFile::seek(%ld)", pos);
+
if (pos >= _bufMark && pos < _bufMark + _lim) {
((_mode == REA) ? _ptr : _lim) = (uint16)(pos - _bufMark);
return pos;
} else {
if (_mode > REA)
- writeBuff();
+ writeBuf();
else
_lim = 0;
@@ -243,11 +275,13 @@ long CFile::seek(long pos) {
void CFile::append(CFile &f) {
+ debugC(1, kDebugFile, "CFile::append(f)");
+
seek(size());
if (f._error == 0) {
while (true) {
if ((_lim = f.IoHand::read(_buff, IOBUF_SIZE)) == IOBUF_SIZE)
- writeBuff();
+ writeBuf();
else
break;
if ((_error = f._error) != 0)
diff --git a/engines/cge/cfile.h b/engines/cge/cfile.h
index bf90633dd0..490e120afa 100644
--- a/engines/cge/cfile.h
+++ b/engines/cge/cfile.h
@@ -49,8 +49,8 @@ protected:
long _bufMark;
uint16 _seed;
CRYPT *_crypt;
- virtual void readBuff();
- virtual void writeBuff();
+ virtual void readBuf();
+ virtual void writeBuf();
public:
IoBuf(IOMODE mode, CRYPT *crpt = NULL);
IoBuf(const char *name, IOMODE mode, CRYPT *crpt = NULL);
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 97712591fa..7e8c8377a8 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -45,6 +45,9 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
// Debug/console setup
DebugMan.addDebugChannel(kCGEDebug, "general", "CGE general debug channel");
+ DebugMan.addDebugChannel(kDebugBitmap, "bitmap", "CGE Bitmap debug channel");
+ DebugMan.addDebugChannel(kDebugFile, "file", "CGE IO debug channel");
+ DebugMan.addDebugChannel(kDebugEngine, "engine", "CGE Engine debug channel");
_isDemo = _gameDescription->flags & ADGF_DEMO;
_startupMode = 1;
@@ -56,6 +59,8 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
}
void CGEEngine::setup() {
+ debugC(1, kDebugEngine, "CGEEngine::setup()");
+
// Initialise fields
_lastFrame = 0;
_lastTick = 0;
@@ -131,7 +136,7 @@ void CGEEngine::setup() {
}
CGEEngine::~CGEEngine() {
- debug("CGEEngine::~CGEEngine");
+ debugC(1, kDebugEngine, "CGEEngine::~CGEEngine()");
// Call classes with static members to clear them up
Talk::deinit();
@@ -169,12 +174,13 @@ CGEEngine::~CGEEngine() {
}
Common::Error CGEEngine::run() {
+ debugC(1, kDebugEngine, "CGEEngine::run()");
+
// Initialize graphics using following:
initGraphics(320, 200, false);
// Setup necessary game objects
setup();
-
// Run the game
cge_main();
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 5187e57c0f..e8451454a4 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -44,7 +44,10 @@ class Sprite;
// our engine debug channels
enum {
- kCGEDebug = 1 << 0
+ kCGEDebug = 1 << 0,
+ kDebugBitmap = 1 << 1,
+ kDebugFile = 1 << 2,
+ kDebugEngine = 1 << 3
};
enum SnList {
@@ -184,6 +187,7 @@ public:
void nextStep();
void switchDebug();
void miniStep(int stp);
+ void AltCtrlDel();
void snBackPt(Sprite *spr, int stp);
void snBarrier(int cav, int bar, bool horz);
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index ad31a5c1e6..34768e42a4 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -104,6 +104,8 @@ Bar _barriers[1 + CAVE_MAX] = { { 0xFF, 0xFF } };
extern Dac _stdPal[58];
void CGEEngine::syncHeader(Common::Serializer &s) {
+ debugC(1, kDebugEngine, "CGEEngine::syncHeader(s)");
+
int i;
s.syncAsUint16LE(_now);
@@ -142,6 +144,8 @@ void CGEEngine::syncHeader(Common::Serializer &s) {
}
bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
+ debugC(1, kDebugEngine, "CGEEngine::loadgame(file, %s)", tiny ? "true" : "false");
+
Common::MemoryReadStream *readStream;
SavegameHeader saveHeader;
@@ -358,6 +362,8 @@ void CGEEngine::syncGame(Common::SeekableReadStream *readStream, Common::WriteSt
}
}
}
+ debugC(1, kDebugEngine, "CGEEngine::saveSound()");
+
}
bool CGEEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header) {
@@ -393,10 +399,14 @@ bool CGEEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &heade
}
void CGEEngine::heroCover(int cvr) {
+ debugC(1, kDebugEngine, "CGEEngine::heroCover(%d)", cvr);
+
SNPOST(SNCOVER, 1, cvr, NULL);
}
void CGEEngine::trouble(int seq, int txt) {
+ debugC(1, kDebugEngine, "CGEEngine::trouble(%d, %d)", seq, txt);
+
_hero->park();
SNPOST(SNWAIT, -1, -1, _hero);
SNPOST(SNSEQ, -1, seq, _hero);
@@ -406,14 +416,20 @@ void CGEEngine::trouble(int seq, int txt) {
}
void CGEEngine::offUse() {
+ debugC(1, kDebugEngine, "CGEEngine::offUse()");
+
trouble(OFF_USE, OFF_USE_TEXT + new_random(_offUseCount));
}
void CGEEngine::tooFar() {
+ debugC(1, kDebugEngine, "CGEEngine::tooFar()");
+
trouble(TOO_FAR, TOO_FAR_TEXT);
}
void CGEEngine::loadHeroXY() {
+ debugC(1, kDebugEngine, "CGEEngine::loadHeroXY()");
+
INI_FILE cf(progName(".HXY"));
memset(_heroXY, 0, sizeof(_heroXY));
if (!cf._error)
@@ -421,6 +437,8 @@ void CGEEngine::loadHeroXY() {
}
void CGEEngine::loadMapping() {
+ debugC(1, kDebugEngine, "CGEEngine::loadMapping()");
+
if (_now <= CAVE_MAX) {
INI_FILE cf(progName(".TAB"));
if (!cf._error) {
@@ -462,6 +480,8 @@ void SQUARE::touch(uint16 mask, int x, int y) {
void CGEEngine::setMapBrick(int x, int z) {
+ debugC(1, kDebugEngine, "CGEEngine::setMapBrick(%d, %d)", x, z);
+
SQUARE *s = new SQUARE(this);
if (s) {
static char n[] = "00:00";
@@ -474,22 +494,24 @@ void CGEEngine::setMapBrick(int x, int z) {
}
}
-//static void switchDebug();
-//static void pullSprite();
-//static void NextStep();
-
void CGEEngine::keyClick() {
+ debugC(1, kDebugEngine, "CGEEngine::keyClick()");
+
SNPOST_(SNSOUND, -1, 5, NULL);
}
void CGEEngine::resetQSwitch() {
+ debugC(1, kDebugEngine, "CGEEngine::resetQSwitch()");
+
SNPOST_(SNSEQ, 123, 0, NULL);
keyClick();
}
void CGEEngine::quit() {
+ debugC(1, kDebugEngine, "CGEEngine::quit()");
+
static Choice QuitMenu[] = {
{ NULL, &CGEEngine::startCountDown },
{ NULL, &CGEEngine::resetQSwitch },
@@ -511,8 +533,10 @@ void CGEEngine::quit() {
}
-static void AltCtrlDel() {
- SNPOST_(SNSAY, -1, A_C_D_TEXT, _hero);
+void CGEEngine::AltCtrlDel() {
+ debugC(1, kDebugEngine, "CGEEngine::setup()");
+
+ SNPOST_(SNSAY, -1, A_C_D_TEXT, _hero);
}
void CGEEngine::miniStep(int stp) {
@@ -716,7 +740,7 @@ void System::touch(uint16 mask, int x, int y) {
switch (x) {
case Del:
if (_keyboard->_key[ALT] && _keyboard->_key[CTRL])
- AltCtrlDel();
+ _vm->AltCtrlDel();
else
_vm->killSprite();
break;
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 4ca1ef57ca..25b7cc25a5 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -238,7 +238,8 @@ uint16 IoHand::read(void *buf, uint16 len) {
}
uint16 IoHand::write(void *buf, uint16 len) {
- error("IOHAND::Write not supported");
+ warning("IOHAND::Write not supported");
+ return 0;
/*
if (len) {
if (Mode == REA || Handle < 0)
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index a7b9d8c080..ca6a9e3bdd 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -1213,6 +1213,8 @@ void Vga::copyPage(uint16 d, uint16 s) {
//--------------------------------------------------------------------------
void Bitmap::xShow(int16 x, int16 y) {
+ debugC(4, kDebugBitmap, "Bitmap::xShow(%d, %d)", x, y);
+
const byte *srcP = (const byte *)_v;
byte *destEndP = (byte *)Vga::_page[1]->pixels + (SCR_WID * SCR_HIG);
byte *lookupTable = _m;
@@ -1264,6 +1266,8 @@ void Bitmap::xShow(int16 x, int16 y) {
void Bitmap::show(int16 x, int16 y) {
+ debugC(5, kDebugBitmap, "Bitmap::show(%d, %d)", x, y);
+
const byte *srcP = (const byte *)_v;
byte *destEndP = (byte *)Vga::_page[1]->pixels + (SCR_WID * SCR_HIG);
@@ -1326,6 +1330,8 @@ void Bitmap::show(int16 x, int16 y) {
void Bitmap::hide(int16 x, int16 y) {
+ debugC(5, kDebugBitmap, "Bitmap::hide(%d, %d)", x, y);
+
for (int yp = y; yp < y + _h; yp++) {
const byte *srcP = (const byte *)Vga::_page[2]->getBasePtr(x, yp);
byte *destP = (byte *)Vga::_page[1]->getBasePtr(x, yp);
@@ -1378,4 +1384,4 @@ PocLight::PocLight(CGEEngine *vm): Sprite(vm, NULL) {
_flags._kill = false;
}
-} // End of namespace CGE \ No newline at end of file
+} // End of namespace CGE
diff --git a/engines/cge/vol.cpp b/engines/cge/vol.cpp
index 04a9189682..cff735abf5 100644
--- a/engines/cge/vol.cpp
+++ b/engines/cge/vol.cpp
@@ -28,6 +28,9 @@
#include "cge/vol.h"
#include "common/system.h"
#include "common/str.h"
+#include "cge/cge.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
namespace CGE {
@@ -44,11 +47,14 @@ Dat::Dat():
_file(DAT_NAME, REA, CRP)
#endif
{
+ debugC(1, kDebugFile, "Dat::Dat()");
}
/*-----------------------------------------------------------------------*/
void VFile::init() {
+ debugC(1, kDebugFile, "VFile::init()");
+
_dat = new Dat();
#ifdef VOL_UPD
_cat = new BtFile(CAT_NAME, UPD, CRP);
@@ -66,6 +72,8 @@ void VFile::deinit() {
VFile::VFile(const char *name, IOMODE mode)
: IoBuf(mode) {
+ debugC(3, kDebugFile, "VFile::VFile(%s, %d)", name, mode);
+
if (mode == REA) {
if (_dat->_file._error || _cat->_error)
error("Bad volume data");
@@ -88,11 +96,15 @@ VFile::~VFile() {
bool VFile::exist(const char *name) {
+ debugC(1, kDebugFile, "VFile::exist(%s)", name);
+
return scumm_stricmp(_cat->find(name)->_key, name) == 0;
}
-void VFile::readBuff() {
+void VFile::readBuf() {
+ debugC(3, kDebugFile, "VFile::readBuf()");
+
if (_recent != this) {
_dat->_file.seek(_bufMark + _lim);
_recent = this;
@@ -106,14 +118,20 @@ void VFile::readBuff() {
}
long VFile::mark() {
+ debugC(5, kDebugFile, "VFile::mark()");
+
return (_bufMark + _ptr) - _begMark;
}
long VFile::size() {
+ debugC(1, kDebugFile, "VFile::size()");
+
return _endMark - _begMark;
}
long VFile::seek(long pos) {
+ debugC(1, kDebugFile, "VFile::seel(%ld)", pos);
+
_recent = NULL;
_lim = 0;
return (_bufMark = _begMark + pos);
diff --git a/engines/cge/vol.h b/engines/cge/vol.h
index 8ed33d0ab4..bbf3237721 100644
--- a/engines/cge/vol.h
+++ b/engines/cge/vol.h
@@ -70,8 +70,8 @@ private:
long _begMark;
long _endMark;
- void readBuff();
- void writeBuff() { }
+ void readBuf();
+ void writeBuf() { }
void make(const char *fspec);
public:
VFile(const char *name, IOMODE mode = REA);