aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cge/bitmap.cpp2
-rw-r--r--engines/cge/cge.cpp6
-rw-r--r--engines/cge/cge.h2
-rw-r--r--engines/cge/cge_main.cpp74
-rw-r--r--engines/cge/cge_main.h1
-rw-r--r--engines/cge/fileio.cpp4
-rw-r--r--engines/cge/general.cpp64
-rw-r--r--engines/cge/snail.cpp4
-rw-r--r--engines/cge/sound.cpp6
-rw-r--r--engines/cge/vga13h.cpp4
-rw-r--r--engines/cge/vmenu.cpp2
11 files changed, 82 insertions, 87 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 87bf49047f..42c1cc908d 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -145,7 +145,7 @@ Bitmap &Bitmap::operator = (const Bitmap &bmp) {
} else {
uint16 vsiz = (uint8 *)bmp._b - (uint8 *)v0;
uint16 siz = vsiz + _h * sizeof(HideDesc);
- uint8 *v1 = (uint8 *) malloc(sizeof(uint8) * siz);
+ uint8 *v1 = (uint8 *)malloc(sizeof(uint8) * siz);
assert(v1 != NULL);
memcpy(v1, v0, siz);
_b = (HideDesc *)((_v = v1) + vsiz);
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index b56635125d..dafb8a3782 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -66,13 +66,13 @@ void CGEEngine::initCaveValues() {
_maxCaveArr[3] = 23;
_maxCaveArr[4] = 24;
- _heroXY = (Hxy *) malloc (sizeof(Hxy) * _caveMax);
+ _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 + _caveMax));
+ _barriers = (Bar *)malloc(sizeof(Bar) * (1 + _caveMax));
for (int i = 0; i < _caveMax + 1; i++) {
_barriers[i]._horz = 0xFF;
_barriers[i]._vert = 0xFF;
@@ -139,6 +139,7 @@ void CGEEngine::init() {
_maxCave = 0;
_dark = false;
_game = false;
+ _finis = false;
_now = 1;
_lev = -1;
_recentStep = -2;
@@ -150,6 +151,7 @@ void CGEEngine::init() {
_soundOk = 1;
_sprTv = NULL;
_gameCase2Cpt = 0;
+ _offUseCount = 0;
_startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
}
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index edb396f4cf..1d38b6a59b 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -119,11 +119,13 @@ public:
bool _flag[4];
bool _dark;
bool _game;
+ bool _finis;
int _now;
int _lev;
int _mode;
int _soundOk;
int _gameCase2Cpt;
+ int _offUseCount;
Sprite *_sprTv;
Sprite *_sprK1;
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 5970a3e339..a6fd08d396 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -84,10 +84,66 @@ const char *savegameStr = "SCUMMVM_CGE";
//--------------------------------------------------------------------------
-static bool _finis = false;
-int _offUseCount;
-
-extern Dac _stdPal[58];
+const Dac g_stdPal[] = {// R G B
+ { 0, 60, 0}, // 198
+ { 0, 104, 0}, // 199
+ { 20, 172, 0}, // 200
+ { 82, 82, 0}, // 201
+ { 0, 132, 82}, // 202
+ { 132, 173, 82}, // 203
+ { 82, 0, 0}, // 204
+ { 206, 0, 24}, // 205
+ { 255, 33, 33}, // 206
+ { 123, 41, 0}, // 207
+ { 0, 41, 0}, // 208
+ { 0, 0, 82}, // 209
+ { 132, 0, 0}, // 210
+ { 255, 0, 0}, // 211
+ { 255, 66, 66}, // 212
+ { 148, 66, 16}, // 213
+ { 0, 82, 0}, // 214
+ { 0, 0, 132}, // 215
+ { 173, 0, 0}, // 216
+ { 255, 49, 0}, // 217
+ { 255, 99, 99}, // 218
+ { 181, 107, 49}, // 219
+ { 0, 132, 0}, // 220
+ { 0, 0, 255}, // 221
+ { 173, 41, 0}, // 222
+ { 255, 82, 0}, // 223
+ { 255, 132, 132}, // 224
+ { 214, 148, 74}, // 225
+ { 41, 214, 0}, // 226
+ { 0, 82, 173}, // 227
+ { 255, 214, 0}, // 228
+ { 247, 132, 49}, // 229
+ { 255, 165, 165}, // 230
+ { 239, 198, 123}, // 231
+ { 173, 214, 0}, // 232
+ { 0, 132, 214}, // 233
+ { 57, 57, 57}, // 234
+ { 247, 189, 74}, // 235
+ { 255, 198, 198}, // 236
+ { 255, 239, 173}, // 237
+ { 214, 255, 173}, // 238
+ { 82, 173, 255}, // 239
+ { 107, 107, 107}, // 240
+ { 247, 222, 99}, // 241
+ { 255, 0, 255}, // 242
+ { 255, 132, 255}, // 243
+ { 132, 132, 173}, // 244
+ { 148, 247, 255}, // 245
+ { 148, 148, 148}, // 246
+ { 82, 0, 82}, // 247
+ { 112, 68, 112}, // 248
+ { 176, 88, 144}, // 249
+ { 214, 132, 173}, // 250
+ { 206, 247, 255}, // 251
+ { 198, 198, 198}, // 252
+ { 0, 214, 255}, // 253
+ { 96, 224, 96 }, // 254
+ { 255, 255, 255}, // 255
+};
void CGEEngine::syncHeader(Common::Serializer &s) {
debugC(1, kCGEDebugEngine, "CGEEngine::syncHeader(s)");
@@ -691,11 +747,11 @@ System::System(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
}
void System::setPal() {
- Dac *p = _vga->_sysPal + 256 - ARRAYSIZE(_stdPal);
- for (uint i = 0; i < ARRAYSIZE(_stdPal); i++) {
- p[i]._r = _stdPal[i]._r >> 2;
- p[i]._g = _stdPal[i]._g >> 2;
- p[i]._b = _stdPal[i]._b >> 2;
+ Dac *p = _vga->_sysPal + 256 - ARRAYSIZE(g_stdPal);
+ for (uint i = 0; i < ARRAYSIZE(g_stdPal); i++) {
+ p[i]._r = g_stdPal[i]._r >> 2;
+ p[i]._g = g_stdPal[i]._g >> 2;
+ p[i]._b = g_stdPal[i]._b >> 2;
}
}
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index 5e2e3bbe46..d91fabc875 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -115,7 +115,6 @@ private:
extern Vga *_vga;
extern System *_sys;
-extern int _offUseCount;
extern Sprite *_pocLight;
extern Keyboard *_keyboard;
extern Mouse *_mouse;
diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp
index b2761f33be..e196a66d26 100644
--- a/engines/cge/fileio.cpp
+++ b/engines/cge/fileio.cpp
@@ -105,7 +105,7 @@ IoBuf::IoBuf(Crypt *crypt)
_lim(0) {
debugC(1, kCGEDebugFile, "IoBuf::IoBuf(crypt)");
- _buff = (uint8 *) malloc(sizeof(uint8) * kBufferSize);
+ _buff = (uint8 *)malloc(sizeof(uint8) * kBufferSize);
assert(_buff != NULL);
}
@@ -116,7 +116,7 @@ IoBuf::IoBuf(const char *name, Crypt *crypt)
_lim(0) {
debugC(1, kCGEDebugFile, "IoBuf::IoBuf(%s, crypt)", name);
- _buff = (uint8 *) malloc(sizeof(uint8) * kBufferSize);
+ _buff = (uint8 *)malloc(sizeof(uint8) * kBufferSize);
assert(_buff != NULL);
}
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 8fbf545535..7cd44a81d0 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -31,67 +31,6 @@
namespace CGE {
-Dac _stdPal[] = {// R G B
- { 0, 60, 0}, // 198
- { 0, 104, 0}, // 199
- { 20, 172, 0}, // 200
- { 82, 82, 0}, // 201
- { 0, 132, 82}, // 202
- { 132, 173, 82}, // 203
- { 82, 0, 0}, // 204
- { 206, 0, 24}, // 205
- { 255, 33, 33}, // 206
- { 123, 41, 0}, // 207
- { 0, 41, 0}, // 208
- { 0, 0, 82}, // 209
- { 132, 0, 0}, // 210
- { 255, 0, 0}, // 211
- { 255, 66, 66}, // 212
- { 148, 66, 16}, // 213
- { 0, 82, 0}, // 214
- { 0, 0, 132}, // 215
- { 173, 0, 0}, // 216
- { 255, 49, 0}, // 217
- { 255, 99, 99}, // 218
- { 181, 107, 49}, // 219
- { 0, 132, 0}, // 220
- { 0, 0, 255}, // 221
- { 173, 41, 0}, // 222
- { 255, 82, 0}, // 223
- { 255, 132, 132}, // 224
- { 214, 148, 74}, // 225
- { 41, 214, 0}, // 226
- { 0, 82, 173}, // 227
- { 255, 214, 0}, // 228
- { 247, 132, 49}, // 229
- { 255, 165, 165}, // 230
- { 239, 198, 123}, // 231
- { 173, 214, 0}, // 232
- { 0, 132, 214}, // 233
- { 57, 57, 57}, // 234
- { 247, 189, 74}, // 235
- { 255, 198, 198}, // 236
- { 255, 239, 173}, // 237
- { 214, 255, 173}, // 238
- { 82, 173, 255}, // 239
- { 107, 107, 107}, // 240
- { 247, 222, 99}, // 241
- { 255, 0, 255}, // 242
- { 255, 132, 255}, // 243
- { 132, 132, 173}, // 244
- { 148, 247, 255}, // 245
- { 148, 148, 148}, // 246
- { 82, 0, 82}, // 247
- { 112, 68, 112}, // 248
- { 176, 88, 144}, // 249
- { 214, 132, 173}, // 250
- { 206, 247, 255}, // 251
- { 198, 198, 198}, // 252
- { 0, 214, 255}, // 253
- { 96, 224, 96 }, // 254
- { 255, 255, 255}, // 255
-};
-
const char *progName(const char *ext) {
static char buf[kMaxFile];
strcpy(buf, "CGE");
@@ -168,8 +107,7 @@ DataCk::DataCk(byte *buf, int bufSize) {
}
DataCk::~DataCk() {
- if (_buf)
- free(_buf);
+ free(_buf);
}
} // End of namespace CGE
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 2d15b61d97..b1fc7629b0 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -399,7 +399,7 @@ const char *Snail::_comText[] = {
Snail::Snail(CGEEngine *vm, bool turbo)
: _turbo(turbo), _busy(false), _textDelay(false),
_timerExpiry(0), _talkEnable(true),
- _head(0), _tail(0), _snList((Com *) malloc(sizeof(Com) * 256)), _vm(vm) {
+ _head(0), _tail(0), _snList((Com *)malloc(sizeof(Com) * 256)), _vm(vm) {
}
Snail::~Snail() {
@@ -863,7 +863,7 @@ void CGEEngine::snFlash(bool on) {
debugC(1, kCGEDebugEngine, "CGEEngine::snFlash(%s)", on ? "true" : "false");
if (on) {
- Dac *pal = (Dac *) malloc(sizeof(Dac) * kPalCount);
+ Dac *pal = (Dac *)malloc(sizeof(Dac) * kPalCount);
if (pal) {
memcpy(pal, _vga->_sysPal, kPalSize);
for (int i = 0; i < kPalCount; i++) {
diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp
index daef3fa429..7a080f3405 100644
--- a/engines/cge/sound.cpp
+++ b/engines/cge/sound.cpp
@@ -192,10 +192,8 @@ MusicPlayer::~MusicPlayer() {
void MusicPlayer::killMidi() {
Audio::MidiPlayer::stop();
- if (_data != NULL) {
- free(_data);
- _data = NULL;
- }
+ free(_data);
+ _data = NULL;
}
void MusicPlayer::loadMidi(int ref) {
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 3db504425f..d4643a32e1 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -685,8 +685,8 @@ Vga::Vga() : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0) {
}
}
- _oldColors = (Dac *) malloc(sizeof(Dac) * kPalCount);
- _newColors = (Dac *) malloc(sizeof(Dac) * kPalCount);
+ _oldColors = (Dac *)malloc(sizeof(Dac) * kPalCount);
+ _newColors = (Dac *)malloc(sizeof(Dac) * kPalCount);
getColors(_oldColors);
sunset();
setColors();
diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp
index 1497d5823c..c213b997a3 100644
--- a/engines/cge/vmenu.cpp
+++ b/engines/cge/vmenu.cpp
@@ -34,7 +34,7 @@ namespace CGE {
MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) {
int h = kFontHigh + 2 * kMenuBarVM;
int i = (w += 2 * kMenuBarHM) * h;
- uint8 *p = (uint8 *) malloc(sizeof(uint8) * i);
+ uint8 *p = (uint8 *)malloc(sizeof(uint8) * i);
memset(p + w, kPixelTransp, i - 2 * w);
memset(p, kMenuBarLT, w);