HDB: Fix variables according to Naming Conventions

This commit is contained in:
Nipun Garg 2019-06-07 18:21:18 +05:30 committed by Eugene Sandulenko
parent 0e58f9c9d1
commit 19eefe2cea
7 changed files with 27 additions and 29 deletions

View File

@ -39,14 +39,14 @@ bool FileMan::openMPC(const Common::String &filename) {
return false;
}
dataHeader.id = _mpcFile->readUint32BE();
_dataHeader.id = _mpcFile->readUint32BE();
if (dataHeader.id == MKTAG('M', 'P', 'C', 'C')) {
if (_dataHeader.id == MKTAG('M', 'P', 'C', 'C')) {
_compressed = true;
debug("COMPRESSED FILE");
return false;
}
else if (dataHeader.id == MKTAG('M', 'P', 'C', 'U')) {
else if (_dataHeader.id == MKTAG('M', 'P', 'C', 'U')) {
_compressed = false;
offset = _mpcFile->readUint32LE();
@ -55,11 +55,11 @@ bool FileMan::openMPC(const Common::String &filename) {
// Note: The MPC archive format assumes the offset to be uint32,
// but Common::File::seek() takes the offset as int32.
dataHeader.dirSize = _mpcFile->readUint32LE();
_dataHeader.dirSize = _mpcFile->readUint32LE();
debug(8, "MPC: Read %d entries", dataHeader.dirSize);
debug(8, "MPC: Read %d entries", _dataHeader.dirSize);
for (uint32 fileIndex = 0; fileIndex < dataHeader.dirSize; fileIndex++) {
for (uint32 fileIndex = 0; fileIndex < _dataHeader.dirSize; fileIndex++) {
MPCEntry *dirEntry = new MPCEntry();
for (int i = 0; i < 64; i++) {

View File

@ -68,9 +68,7 @@ public:
struct {
uint32 id;
uint32 dirSize;
} dataHeader;
uint32 readOffset;
} _dataHeader;
bool openMPC(const Common::String &filename);
void closeMPC();

View File

@ -42,8 +42,8 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst
_console = nullptr;
_systemInit = false;
g_hdb = this;
fileMan = new FileMan;
lua = new LuaScript;
_fileMan = new FileMan;
_lua = new LuaScript;
//mapLoader = new MapLoader;
DebugMan.addDebugChannel(kDebugExample1, "Example1", "This is just an example to test");
@ -52,8 +52,8 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst
HDBGame::~HDBGame() {
delete _console;
delete fileMan;
delete lua;
delete _fileMan;
delete _lua;
//delete mapLoader;
DebugMan.clearAllDebugChannels();
}
@ -65,11 +65,11 @@ bool HDBGame::init() {
// Init fileMan
if (!fileMan->openMPC(getGameFile())) {
if (!_fileMan->openMPC(getGameFile())) {
error("FileMan::openMPC: Cannot find the hyperspace.mpc data file.");
return false;
}
if (!lua->init()) {
if (!_lua->init()) {
error("LuaScript::init: Couldn't load the GLOBAL_LUA code.");
return false;
}
@ -123,7 +123,7 @@ Common::Error HDBGame::run() {
_console = new Console();
Common::SeekableReadStream *titleStream = fileMan->findFirstData("monkeylogoscreen", TYPE_PIC);
Common::SeekableReadStream *titleStream = _fileMan->findFirstData("monkeylogoscreen", TYPE_PIC);
if (titleStream == NULL) {
debug("The TitleScreen MPC entry can't be found.");
return Common::kReadingFailed;
@ -132,7 +132,7 @@ Common::Error HDBGame::run() {
Picture *titlePic = new Picture;
Graphics::Surface surf = titlePic->load(titleStream);
Common::SeekableReadStream *tileStream = fileMan->findFirstData("t32_ground1", TYPE_TILE32);
Common::SeekableReadStream *tileStream = _fileMan->findFirstData("t32_ground1", TYPE_TILE32);
if (tileStream == NULL) {
debug("The t32_shipwindow_lr MPC entry can't be found.");
return Common::kReadingFailed;
@ -141,16 +141,16 @@ Common::Error HDBGame::run() {
Tile *tile = new Tile;
Graphics::Surface surf2 = tile->load(tileStream);
Common::SeekableReadStream *luaStream = fileMan->findFirstData("MAP00_DEMO_LUA", TYPE_BINARY);
int32 luaLength = fileMan->getLength("MAP00_DEMO_LUA", TYPE_BINARY);
Common::SeekableReadStream *luaStream = _fileMan->findFirstData("MAP00_DEMO_LUA", TYPE_BINARY);
int32 luaLength = _fileMan->getLength("MAP00_DEMO_LUA", TYPE_BINARY);
if (luaStream == NULL) {
debug("The MAP00_DEMO_LUA MPC entry can't be found.");
return Common::kReadingFailed;
}
lua->initScript(luaStream, "MAP00_DEMO_LUA", luaLength);
_lua->initScript(luaStream, "MAP00_DEMO_LUA", luaLength);
Common::SeekableReadStream *mapStream = fileMan->findFirstData("MAP00_DEMO_MSM", TYPE_BINARY);
Common::SeekableReadStream *mapStream = _fileMan->findFirstData("MAP00_DEMO_MSM", TYPE_BINARY);
if (mapStream == NULL) {
debug("The MAP00_DEMO_MSM MPC entry can't be found.");
return Common::kReadingFailed;

View File

@ -82,8 +82,8 @@ public:
Game System Pointers
*/
FileMan *fileMan;
LuaScript *lua;
FileMan *_fileMan;
LuaScript *_lua;
// Game related members;

View File

@ -54,8 +54,8 @@ LuaScript::~LuaScript() {
bool LuaScript::init() {
// Load Global Lua Code
_globalLuaStream = g_hdb->fileMan->findFirstData("GLOBAL_LUA", TYPE_BINARY);
_globalLuaLength = g_hdb->fileMan->getLength("GLOBAL_LUA", TYPE_BINARY);
_globalLuaStream = g_hdb->_fileMan->findFirstData("GLOBAL_LUA", TYPE_BINARY);
_globalLuaLength = g_hdb->_fileMan->getLength("GLOBAL_LUA", TYPE_BINARY);
if (_globalLuaStream == NULL || _globalLuaLength == 0) {
error("LuaScript::initScript: 'global code' failed to load");
return false;

View File

@ -88,7 +88,7 @@ bool Map::load(Common::SeekableReadStream *stream) {
_mapLaserBeams = new char[_width * _height];
mapX = mapY = 0;
_mapX = _mapY = 0;
_mapLoaded = true;

View File

@ -53,9 +53,9 @@ public:
bool load(Common::SeekableReadStream *stream);
int loadTiles();
int mapX, mapY; // Coordinates of Map
int mapTileX, mapTileY; // Tile Coordinates of Map
int mapTileXOff, mapTileYOff; // Tile Coordinates Offset (0-31)
int _mapX, _mapY; // Coordinates of Map
int _mapTileX, _mapTileY; // Tile Coordinates of Map
int _mapTileXOff, _mapTileYOff; // Tile Coordinates Offset (0-31)
private:
char _name[32];