aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cge/bitmap.cpp112
-rw-r--r--engines/cge/bitmap.h5
-rw-r--r--engines/cge/cge_main.cpp4
-rw-r--r--engines/cge/cge_main.h1
-rw-r--r--engines/cge/events.cpp5
-rw-r--r--engines/cge/jbw.h1
-rw-r--r--engines/cge/mixer.cpp4
-rw-r--r--engines/cge/vga13h.cpp20
-rw-r--r--engines/cge/walk.cpp2
9 files changed, 24 insertions, 130 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 0829600902..1de10e2bfd 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -48,36 +48,18 @@ void Bitmap::deinit() {
}
#pragma argsused
-Bitmap::Bitmap(const char *fname, bool rem) : _m(NULL), _v(NULL), _map(0) {
- debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(%s, %s)", fname, rem ? "true" : "false");
+Bitmap::Bitmap(const char *fname) : _m(NULL), _v(NULL), _map(0) {
+ debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(%s)", fname);
char pat[kMaxPath];
forceExt(pat, fname, ".VBM");
-#if (BMP_MODE < 2)
- if (rem && PIC_FILE::exist(pat)) {
+ if (PIC_FILE::exist(pat)) {
PIC_FILE file(pat);
if ((file._error == 0) && (!loadVBM(&file)))
error("Bad VBM [%s]", fname);
- } else
-#endif
- {
-#if (BMP_MODE)
- forceExt(pat, fname, ".BMP");
- PIC_FILE file(pat);
- if (file._error == 0) {
- if (loadBMP(&file)) {
- code();
- if (rem) {
- free(_m);
- _m = NULL;
- }
- } else
- error("Bad BMP [%s]", fname);
- }
-#else
+ } else {
error("Bad VBM [%s]", fname);
-#endif
}
}
@@ -115,7 +97,7 @@ Bitmap::Bitmap(uint16 w, uint16 h, uint8 fill)
*(uint16 *)(v + psiz - 2) = TO_LE_16(kBmpEOI); // plane trailer uint16
- // Repliccate planes
+ // Replicate planes
for (destP = v + psiz; destP < (v + 4 * psiz); destP += psiz)
Common::copy(v, v + psiz, destP);
@@ -364,33 +346,6 @@ bool Bitmap::solidAt(int16 x, int16 y) {
}
}
-bool Bitmap::saveVBM(XFile *f) {
- debugC(1, kCGEDebugBitmap, "Bitmap::saveVBM(f)");
-
- 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 * 3);
-
- if (f->_error == 0)
- f->write(_v, n);
-
- return (f->_error == 0);
-}
-
bool Bitmap::loadVBM(XFile *f) {
debugC(5, kCGEDebugBitmap, "Bitmap::loadVBM(f)");
@@ -438,61 +393,4 @@ bool Bitmap::loadVBM(XFile *f) {
return (f->_error == 0);
}
-bool Bitmap::loadBMP(XFile *f) {
- debugC(1, kCGEDebugBitmap, "Bitmap::loadBMP(f)");
-
- struct {
- char BM[2];
- union { int16 len; int32 len_; };
- union { int16 _06; int32 _06_; };
- union { int16 hdr; int32 hdr_; };
- union { int16 _0E; int32 _0E_; };
- union { int16 wid; int32 wid_; };
- union { int16 hig; int32 hig_; };
- union { int16 _1A; int32 _1A_; };
- union { int16 _1E; int32 _1E_; };
- union { int16 _22; int32 _22_; };
- union { int16 _26; int32 _26_; };
- union { int16 _2A; int32 _2A_; };
- union { int16 _2E; int32 _2E_; };
- union { int16 _32; int32 _32_; };
- } hea;
-
- Bgr4 bpal[256];
-
- f->read((byte *)&hea, sizeof(hea));
- if (f->_error == 0) {
- if (hea.hdr == 0x436L) {
- int16 i = (hea.hdr - sizeof(hea)) / sizeof(Bgr4);
- f->read((byte *)&bpal, sizeof(bpal));
- if (f->_error == 0) {
- if (_pal) {
- for (i = 0; i < 256; i++) {
- _pal[i]._r = bpal[i]._R;
- _pal[i]._g = bpal[i]._G;
- _pal[i]._b = bpal[i]._B;
- }
- _pal = NULL;
- }
- _h = hea.hig;
- _w = hea.wid;
- if ((_m = (byte *) malloc(sizeof(byte) * (_h * _w))) != NULL) {
- int16 r = (4 - (hea.wid & 3)) % 4;
- byte buf[3];
- for (i = _h - 1; i >= 0; i--) {
- f->read(_m + (_w * i), _w);
- if (r && f->_error == 0)
- f->read(buf, r);
- if (f->_error)
- break;
- }
- if (i < 0)
- return true;
- }
- }
- }
- }
- return false;
-}
-
} // End of namespace CGE
diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h
index 30e11d08ec..7604cb8081 100644
--- a/engines/cge/bitmap.h
+++ b/engines/cge/bitmap.h
@@ -60,7 +60,6 @@ struct HideDesc {
#include "common/pack-end.h"
class Bitmap {
- bool loadBMP(XFile *f);
bool loadVBM(XFile *f);
public:
static Dac *_pal;
@@ -71,7 +70,7 @@ public:
int32 _map;
HideDesc *_b;
- Bitmap(const char *fname, bool rem);
+ Bitmap(const char *fname);
Bitmap(uint16 w, uint16 h, uint8 *map);
Bitmap(uint16 w, uint16 h, uint8 fill);
Bitmap(const Bitmap &bmp);
@@ -79,14 +78,12 @@ public:
static void init();
static void deinit();
- Bitmap *flipH();
Bitmap *code();
Bitmap &operator = (const Bitmap &bmp);
void hide(int16 x, int16 y);
void show(int16 x, int16 y);
void xShow(int16 x, int16 y);
bool solidAt(int16 x, int16 y);
- bool saveVBM(XFile *f);
uint16 moveVmap(uint8 *buf);
};
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 91de45e447..99cb5d487f 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -473,7 +473,7 @@ Square::Square(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
_flags._bDel = false;
BitmapPtr *MB = new BitmapPtr[2];
- MB[0] = new Bitmap("BRICK", true);
+ MB[0] = new Bitmap("BRICK");
MB[1] = NULL;
setShapeList(MB);
}
@@ -1630,7 +1630,7 @@ bool CGEEngine::showTitle(const char *name) {
Bitmap::_pal = Vga::_sysPal;
BitmapPtr *LB = new BitmapPtr[2];
- LB[0] = new Bitmap(name, true);
+ LB[0] = new Bitmap(name);
LB[1] = NULL;
Bitmap::_pal = NULL;
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index 1c85816c3e..1c5f818217 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -93,7 +93,6 @@ namespace CGE {
class System : public Sprite {
- int _lum;
public:
int _funDel;
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp
index 342a0a8cb1..6e23b4e613 100644
--- a/engines/cge/events.cpp
+++ b/engines/cge/events.cpp
@@ -169,8 +169,8 @@ Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0)
setSeq(seq);
BitmapPtr *MC = new BitmapPtr[3];
- MC[0] = new Bitmap("MOUSE", true);
- MC[1] = new Bitmap("DUMMY", true);
+ MC[0] = new Bitmap("MOUSE");
+ MC[1] = new Bitmap("DUMMY");
MC[2] = NULL;
setShapeList(MC);
@@ -245,6 +245,7 @@ EventManager::EventManager() {
_quitFlag = false;
_eventQueueHead = 0;
_eventQueueTail = 0;
+ memset(&_eventQueue, 0, kEventMax * sizeof(CGEEvent));
memset(&_event, 0, sizeof(Common::Event));
}
diff --git a/engines/cge/jbw.h b/engines/cge/jbw.h
index 128a92f594..0ba8a1956b 100644
--- a/engines/cge/jbw.h
+++ b/engines/cge/jbw.h
@@ -35,7 +35,6 @@ namespace CGE {
// Defines found in cge.mak
#define INI_FILE VFile // Or is it CFile?
#define PIC_FILE VFile
-#define BMP_MODE 0
//
#define kMaxFile 128
diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp
index 8390647cec..c483653ec2 100644
--- a/engines/cge/mixer.cpp
+++ b/engines/cge/mixer.cpp
@@ -40,7 +40,7 @@ bool Mixer::_appear = false;
Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(kMixFall), _vm(vm) {
_appear = true;
- _mb[0] = new Bitmap("VOLUME", true);
+ _mb[0] = new Bitmap("VOLUME");
_mb[1] = NULL;
setShapeList(_mb);
setName(_text->getText(kMixName));
@@ -57,7 +57,7 @@ Mixer::Mixer(CGEEngine *vm, int x, int y) : Sprite(vm, NULL), _fall(kMixFall), _
for (uint i = 0; i < kMixMax; i++) {
static char fn[] = "V00";
wtom(i, fn + 1, 10, 2);
- _lb[i] = new Bitmap(fn, true);
+ _lb[i] = new Bitmap(fn);
ls[i]._now = ls[i]._next = i;
ls[i]._dx = ls[i]._dy = ls[i]._dly = 0;
}
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 7e4daeb898..80060bfd74 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -289,7 +289,7 @@ Sprite *Sprite::expand() {
++_shpCnt;
}
- shplist[shpcnt++] = new Bitmap(strtok(NULL, " \t,;/"), true);
+ shplist[shpcnt++] = new Bitmap(strtok(NULL, " \t,;/"));
break;
}
case 2 : { // Seq
@@ -344,7 +344,7 @@ Sprite *Sprite::expand() {
}
}
} else { // no sprite description: try to read immediately from .BMP
- shplist[shpcnt++] = new Bitmap(_file, true);
+ shplist[shpcnt++] = new Bitmap(_file);
}
shplist[shpcnt] = NULL;
if (seq) {
@@ -1082,7 +1082,7 @@ void Bitmap::hide(int16 x, int16 y) {
HorizLine::HorizLine(CGEEngine *vm): Sprite(vm, NULL) {
// Set the sprite list
BitmapPtr *HL = new BitmapPtr[2];
- HL[0] = new Bitmap("HLINE", true);
+ HL[0] = new Bitmap("HLINE");
HL[1] = NULL;
setShapeList(HL);
@@ -1091,7 +1091,7 @@ HorizLine::HorizLine(CGEEngine *vm): Sprite(vm, NULL) {
CavLight::CavLight(CGEEngine *vm): Sprite(vm, NULL) {
// Set the sprite list
BitmapPtr *PR = new BitmapPtr[2];
- PR[0] = new Bitmap("PRESS", true);
+ PR[0] = new Bitmap("PRESS");
PR[1] = NULL;
setShapeList(PR);
@@ -1100,8 +1100,8 @@ CavLight::CavLight(CGEEngine *vm): Sprite(vm, NULL) {
Spike::Spike(CGEEngine *vm): Sprite(vm, NULL) {
// Set the sprite list
BitmapPtr *SP = new BitmapPtr[3];
- SP[0] = new Bitmap("SPK_L", true);
- SP[1] = new Bitmap("SPK_R", true);
+ SP[0] = new Bitmap("SPK_L");
+ SP[1] = new Bitmap("SPK_R");
SP[2] = NULL;
setShapeList(SP);
@@ -1110,10 +1110,10 @@ Spike::Spike(CGEEngine *vm): Sprite(vm, NULL) {
PocLight::PocLight(CGEEngine *vm): Sprite(vm, NULL) {
// Set the sprite list
BitmapPtr *LI = new BitmapPtr[5];
- LI[0] = new Bitmap("LITE0", true);
- LI[1] = new Bitmap("LITE1", true);
- LI[2] = new Bitmap("LITE2", true);
- LI[3] = new Bitmap("LITE3", true);
+ LI[0] = new Bitmap("LITE0");
+ LI[1] = new Bitmap("LITE1");
+ LI[2] = new Bitmap("LITE2");
+ LI[3] = new Bitmap("LITE3");
LI[4] = NULL;
setShapeList(LI);
diff --git a/engines/cge/walk.cpp b/engines/cge/walk.cpp
index 89d7f6308b..914f6db669 100644
--- a/engines/cge/walk.cpp
+++ b/engines/cge/walk.cpp
@@ -71,7 +71,7 @@ Cluster XZ(Couple xy) {
}
Walk::Walk(CGEEngine *vm, BitmapPtr *shpl)
- : Sprite(vm, shpl), _dir(kDirNone), _tracePtr(-1), _level(0), _target(-1, -1), _vm(vm) {
+ : Sprite(vm, shpl), _dir(kDirNone), _tracePtr(-1), _level(0), _target(-1, -1), _findLevel(-1), _vm(vm) {
}