aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2019-09-06 08:02:29 +0200
committerStrangerke2019-09-06 08:16:04 +0200
commitd1b9e1db7a7bf8394492d3c82a9598d2ba2a98cf (patch)
treeabd359fab97e904b32e6b7313d374261e7af7c22
parenta31593131bb6df8e68f0df7784072dd25238277b (diff)
downloadscummvm-rg350-d1b9e1db7a7bf8394492d3c82a9598d2ba2a98cf.tar.gz
scummvm-rg350-d1b9e1db7a7bf8394492d3c82a9598d2ba2a98cf.tar.bz2
scummvm-rg350-d1b9e1db7a7bf8394492d3c82a9598d2ba2a98cf.zip
HDB: Initialize some more uninitialized variables.
-rw-r--r--engines/hdb/file-manager.cpp19
-rw-r--r--engines/hdb/hdb.cpp28
-rw-r--r--engines/hdb/hdb.h6
-rw-r--r--engines/hdb/map.cpp14
4 files changed, 48 insertions, 19 deletions
diff --git a/engines/hdb/file-manager.cpp b/engines/hdb/file-manager.cpp
index bc751749f5..9c2eca1a11 100644
--- a/engines/hdb/file-manager.cpp
+++ b/engines/hdb/file-manager.cpp
@@ -31,6 +31,8 @@ namespace HDB {
FileMan::FileMan() {
_mpcFile = new Common::File;
+ _dataHeader.id = 0;
+ _dataHeader.dirSize = 0;
}
FileMan::~FileMan() {
@@ -40,23 +42,17 @@ FileMan::~FileMan() {
}
void FileMan::openMPC(const Common::String &filename) {
- if (!_mpcFile->open(filename)) {
+ if (!_mpcFile->open(filename))
error("FileMan::openMPC(): Error reading the MSD/MPC file %s", filename.c_str());
- }
_dataHeader.id = _mpcFile->readUint32BE();
- if (_dataHeader.id == MKTAG('M', 'P', 'C', 'C')) {
+ if (_dataHeader.id == MKTAG('M', 'P', 'C', 'C'))
error("FileMan::openMPC: Compressed MPC File");
- } else if (_dataHeader.id == MKTAG('M', 'P', 'C', 'U')) {
- // we're fine
- } else if (_dataHeader.id == MKTAG('M', 'S', 'D', 'C')) {
- // we're fine
- } else if (_dataHeader.id == MKTAG('M', 'S', 'D', 'U')) {
+ else if (_dataHeader.id == MKTAG('M', 'S', 'D', 'U'))
error("FileMan::openMPC: Uncompressed MSD File");
- } else {
+ else if (_dataHeader.id != MKTAG('M', 'P', 'C', 'U') && _dataHeader.id != MKTAG('M', 'S', 'D', 'C'))
error("FileMan::openMPC: Invalid MPC/MSD File.");
- }
// read the directory
uint32 offset = _mpcFile->readUint32LE();
@@ -72,9 +68,8 @@ void FileMan::openMPC(const Common::String &filename) {
for (uint32 fileIndex = 0; fileIndex < _dataHeader.dirSize; fileIndex++) {
MPCEntry *dirEntry = new MPCEntry();
- for (int i = 0; i < 64; i++) {
+ for (int i = 0; i < 64; i++)
dirEntry->filename[i] = tolower(_mpcFile->readByte());
- }
dirEntry->offset = _mpcFile->readUint32LE();
dirEntry->length = _mpcFile->readUint32LE();
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index c7c206c145..5b09f3de09 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -90,6 +90,27 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst
_monkeystone14 = STARS_MONKEYSTONE_14_FAKE;
_monkeystone21 = STARS_MONKEYSTONE_21_FAKE;
+ _gameShutdown = false;
+ _progressGfx = nullptr;
+ _progressMarkGfx = nullptr;
+ _loadingScreenGfx = nullptr;
+ _logoGfx = nullptr;
+ _progressCurrent = -1;
+ _progressXOffset = -1;
+ _progressMax = -1;
+ _gameState = GAME_TITLE;
+ _actionMode = -1;
+ _pauseFlag = false;
+ _debugFlag = -1;
+ _debugLogo = nullptr;
+ _dx = 0;
+ _dy = 0;
+ _changeLevel = false;
+ _saveInfo.active = false;
+ _saveInfo.slot = 0;
+ _loadInfo.active = false;
+ _loadInfo.slot = 0;
+
syncSoundSettings();
}
@@ -159,7 +180,7 @@ bool HDBGame::init() {
_menu->startTitle();
_gameShutdown = false;
- _pauseFlag = 0;
+ _pauseFlag = false;
_systemInit = true;
if (!g_hdb->isPPC())
_loadingScreenGfx = _gfx->loadPic(PIC_LOADSCREEN);
@@ -355,11 +376,10 @@ void HDBGame::paint() {
}
// Draw FPS on Screen in Debug Mode
- if (_debugFlag == 1) {
+ if (_debugFlag == 1)
_gfx->drawDebugInfo(_debugLogo, _frames.size());
- } else if (_debugFlag == 2) {
+ else if (_debugFlag == 2)
_debugLogo->drawMasked(_screenWidth - 32, 0);
- }
_gfx->updateVideo();
}
diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h
index eb3a81886a..8a23bdb6a6 100644
--- a/engines/hdb/hdb.h
+++ b/engines/hdb/hdb.h
@@ -248,10 +248,10 @@ public:
}
void togglePause() {
- _pauseFlag ^= 1;
+ _pauseFlag ^= true;
}
- int getPause() {
+ bool getPause() {
return _pauseFlag;
}
@@ -345,7 +345,7 @@ private:
int _actionMode; // 0 or 1
// Misc Variables
- int _pauseFlag;
+ bool _pauseFlag;
bool _cheating;
int _debugFlag;
Tile *_debugLogo;
diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp
index a0eedcb58c..0edc51389b 100644
--- a/engines/hdb/map.cpp
+++ b/engines/hdb/map.cpp
@@ -55,6 +55,20 @@ Map::Map() {
_background = NULL;
_foreground = NULL;
_iconList = NULL;
+
+ _width = 0;
+ _height = 0;
+ _mapX = 0;
+ _mapY = 0;
+ _mapTileX = 0;
+ _mapTileY = 0;
+ _mapTileXOff = 0;
+ _mapTileYOff = 0;
+ _backgroundOffset = 0;
+ _foregroundOffset = 0;
+ _iconNum = 0;
+ _iconListOffset = 0;
+ _infoNum = 0;
}
Map::~Map() {