Skip to content

Commit

Permalink
DM: Fix some more non-MSVC warnings, remove a useless variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Sep 16, 2016
1 parent 8534120 commit 421d47d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 23 deletions.
1 change: 0 additions & 1 deletion engines/dm/dm.cpp
Expand Up @@ -138,7 +138,6 @@ DMEngine::DMEngine(OSystem *syst, const DMADGameDescription *desc) : Engine(syst
_stopWaitingForPlayerInput = true;
_gameTimeTicking = false;
_restartGameAllowed = false;
_gameId = 0;
_pressingEye = false;
_stopPressingEye = false;
_pressingMouth = false;
Expand Down
1 change: 0 additions & 1 deletion engines/dm/dm.h
Expand Up @@ -304,7 +304,6 @@ class DMEngine : public Engine {
bool _stopWaitingForPlayerInput; // @ G0321_B_StopWaitingForPlayerInput
bool _gameTimeTicking; // @ G0301_B_GameTimeTicking
bool _restartGameAllowed; // @ G0524_B_RestartGameAllowed
int32 _gameId; // @ G0525_l_GameID, probably useless here
bool _pressingEye; // @ G0331_B_PressingEye
bool _stopPressingEye; // @ G0332_B_StopPressingEye
bool _pressingMouth; // @ G0333_B_PressingMouth
Expand Down
4 changes: 2 additions & 2 deletions engines/dm/group.cpp
Expand Up @@ -199,7 +199,7 @@ void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int
};
static uint16 fixedPossessionCreature4PainRatHellHound[3] = { // @ G0250_aui_Graphic559_FixedPossessionsCreature04PainRat_Hellhound
kDMObjectInfoIndexFirstJunk + kDMJunkTypeDrumstickShank,
kDMObjectInfoIndexFirstJunk + kDMJunkTypeDrumstickShank | kDMMaskRandomDrop,
(kDMObjectInfoIndexFirstJunk + kDMJunkTypeDrumstickShank) | kDMMaskRandomDrop,
0
};
static uint16 fixedPossessionCreature6screamer[3] = { // @ G0251_aui_Graphic559_FixedPossessionsCreature06Screamer
Expand Down Expand Up @@ -393,7 +393,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex

if (group->_health[creatureIndex] <= damage) {
uint16 groupCells = getGroupCells(group, _vm->_dungeonMan->_currMapIndex);
uint16 cell = (groupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : getCreatureValue(groupCells, creatureIndex);
uint16 cell = (groupCells == k255_CreatureTypeSingleCenteredCreature) ? (uint16)k255_CreatureTypeSingleCenteredCreature : getCreatureValue(groupCells, creatureIndex);
uint16 creatureCount = group->getCount();
uint16 retVal;

Expand Down
34 changes: 15 additions & 19 deletions engines/dm/loadsave.cpp
Expand Up @@ -56,24 +56,19 @@ LoadgameResult DMEngine::loadgame(int16 slot) {
int32 _saveVersion;
OriginalSaveFormat _saveFormat;
OriginalSavePlatform _savePlatform;

int32 _gameId;
uint16 _dungeonId;
} dmSaveHeader;

if (!_newGameFl) {
fileName = getSavefileName(slot);
saveFileManager = _system->getSavefileManager();
file = saveFileManager->openForLoading(fileName);
}

if (_newGameFl) {
//L1366_B_FadePalette = !F0428_DIALOG_RequireGameDiskInDrive_NoDialogDrawn(C0_DO_NOT_FORCE_DIALOG_DM_CSB, true);
_restartGameAllowed = false;
_championMan->_partyChampionCount = 0;
_championMan->_leaderHandObject = Thing::_none;
_gameId = ((int32)getRandomNumber(65536)) * getRandomNumber(65536);
} else {
fileName = getSavefileName(slot);
saveFileManager = _system->getSavefileManager();
file = saveFileManager->openForLoading(fileName);

SaveGameHeader header;
readSaveGameHeader(file, &header);

Expand All @@ -83,10 +78,10 @@ LoadgameResult DMEngine::loadgame(int16 slot) {
dmSaveHeader._saveVersion = file->readSint32BE();
dmSaveHeader._saveFormat = (OriginalSaveFormat)file->readSint32BE();
dmSaveHeader._savePlatform = (OriginalSavePlatform)file->readSint32BE();
dmSaveHeader._gameId = file->readSint32BE();
dmSaveHeader._dungeonId = file->readUint16BE();

_gameId = dmSaveHeader._gameId;
// Skip _gameId, which was useless
file->readSint32BE();
dmSaveHeader._dungeonId = file->readUint16BE();

_gameTime = file->readSint32BE();
// G0349_ul_LastRandomNumber = L1371_s_GlobalData.LastRandomNumber;
Expand Down Expand Up @@ -121,6 +116,8 @@ LoadgameResult DMEngine::loadgame(int16 slot) {
// read sentinel
uint32 sentinel = file->readUint32BE();
assert(sentinel == 0x6f85e3d3);

_dungeonId = dmSaveHeader._dungeonId;
}

_dungeonMan->loadDungeonFile(file);
Expand All @@ -137,21 +134,18 @@ LoadgameResult DMEngine::loadgame(int16 slot) {
_displayMan->startEndFadeToPalette(_displayMan->_paletteTopAndBottomScreen);
}
} else {
_dungeonId = dmSaveHeader._dungeonId;

_restartGameAllowed = true;

switch (getGameLanguage()) { // localized
default:
case Common::EN_ANY:
_dialog->dialogDraw(nullptr, "LOADING GAME . . .", nullptr, nullptr, nullptr, nullptr, true, true, true);
break;
case Common::DE_DEU:
_dialog->dialogDraw(nullptr, "SPIEL WIRD GELADEN . . .", nullptr, nullptr, nullptr, nullptr, true, true, true);
break;
case Common::FR_FRA:
_dialog->dialogDraw(nullptr, "CHARGEMENT DU JEU . . .", nullptr, nullptr, nullptr, nullptr, true, true, true);
break;
default:
_dialog->dialogDraw(nullptr, "LOADING GAME . . .", nullptr, nullptr, nullptr, nullptr, true, true, true);
break;
}
}
_championMan->_partyDead = false;
Expand Down Expand Up @@ -298,7 +292,9 @@ bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip
file->writeSint32BE(1); // save version
file->writeSint32BE(_gameVersion->_origSaveFormatToWrite);
file->writeSint32BE(_gameVersion->_origPlatformToWrite);
file->writeSint32BE(_gameId);

// Was _gameID, useless.
file->writeSint32BE(0);
file->writeUint16BE(_dungeonId);

// write C0_SAVE_PART_GLOBAL_DATA part
Expand Down

0 comments on commit 421d47d

Please sign in to comment.