aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/game
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lastexpress/game')
-rw-r--r--engines/lastexpress/game/menu.cpp8
-rw-r--r--engines/lastexpress/game/savegame.cpp13
-rw-r--r--engines/lastexpress/game/sound.cpp9
-rw-r--r--engines/lastexpress/game/sound.h2
4 files changed, 22 insertions, 10 deletions
diff --git a/engines/lastexpress/game/menu.cpp b/engines/lastexpress/game/menu.cpp
index 9e38d05444..65b9cd9a91 100644
--- a/engines/lastexpress/game/menu.cpp
+++ b/engines/lastexpress/game/menu.cpp
@@ -180,7 +180,7 @@ static const struct {
//////////////////////////////////////////////////////////////////////////
class Clock {
public:
- Clock(LastExpressEngine *engine);
+ explicit Clock(LastExpressEngine *engine);
~Clock();
void draw(uint32 time);
@@ -271,7 +271,7 @@ void Clock::draw(uint32 time) {
//////////////////////////////////////////////////////////////////////////
class TrainLine {
public:
- TrainLine(LastExpressEngine *engine);
+ explicit TrainLine(LastExpressEngine *engine);
~TrainLine();
void draw(uint32 time);
@@ -1454,13 +1454,13 @@ void Menu::adjustTime() {
if (_currentTime < _time) {
timeDelta *= 900;
- _time -= timeDelta.toInt();
+ _time -= (uint)timeDelta.toInt();
if (_currentTime > _time)
_time = _currentTime;
} else {
timeDelta *= 900;
- _time += timeDelta.toInt();
+ _time += (uint)timeDelta.toInt();
if (_currentTime < _time)
_time = _currentTime;
diff --git a/engines/lastexpress/game/savegame.cpp b/engines/lastexpress/game/savegame.cpp
index 2d88c2dca4..ba9e172b2b 100644
--- a/engines/lastexpress/game/savegame.cpp
+++ b/engines/lastexpress/game/savegame.cpp
@@ -63,7 +63,7 @@ SaveLoad::SaveLoad(LastExpressEngine *engine) : _engine(engine), _savegame(NULL)
SaveLoad::~SaveLoad() {
clear(true);
- //Zero passed pointers
+ // Zero passed pointers
_engine = NULL;
}
@@ -191,6 +191,9 @@ void SaveLoad::clear(bool clearStream) {
// Load game
void SaveLoad::loadGame(GameId id) {
+ if (!_savegame)
+ error("SaveLoad::loadGame: No savegame stream present!");
+
// Rewind current savegame
_savegame->seek(0);
@@ -201,6 +204,9 @@ void SaveLoad::loadGame(GameId id) {
return;
}
+ if (!_savegame)
+ error("SaveLoad::loadGame: No savegame stream present!");
+
// Load the last entry
_savegame->seek(header.offsetEntry);
@@ -419,6 +425,9 @@ void SaveLoad::readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, b
if (!type || !entity || !val)
error("SaveLoad::readEntry: Invalid parameters passed!");
+ if (!_savegame)
+ error("SaveLoad::readEntry: No savegame stream present!");
+
// Load entry header
SavegameEntryHeader entry;
Common::Serializer ser(_savegame, NULL);
@@ -452,7 +461,7 @@ void SaveLoad::readEntry(SavegameType *type, EntityIndex *entity, uint32 *val, b
getProgress().chapter = entry.chapter;
// Skip padding
- uint32 offset = _savegame->pos() - originalPosition;
+ uint32 offset = (uint32)_savegame->pos() - originalPosition;
if (offset & 0xF) {
_savegame->seek((~offset & 0xF) + 1, SEEK_SET);
}
diff --git a/engines/lastexpress/game/sound.cpp b/engines/lastexpress/game/sound.cpp
index 652703c285..5638f75d00 100644
--- a/engines/lastexpress/game/sound.cpp
+++ b/engines/lastexpress/game/sound.cpp
@@ -359,7 +359,7 @@ void SoundManager::loadSoundData(SoundEntry *entry, Common::String name) {
}
}
-void SoundManager::resetEntry(SoundEntry *entry) {
+void SoundManager::resetEntry(SoundEntry *entry) const {
entry->status.status |= kSoundStatusRemoved;
entry->entity = kEntityPlayer;
@@ -1763,7 +1763,7 @@ void SoundManager::updateSubtitles() {
if (!(status & kSoundStatus_40)
|| status & 0x180
- || soundEntry->time <= 0
+ || soundEntry->time == 0
|| (status & 0x1F) < 6
|| ((getFlags()->nis & 0x8000) && soundEntry->field_4C < 90)) {
current_index = 0;
@@ -1845,7 +1845,7 @@ void SoundManager::setupSubtitleAndDraw(SubtitleEntry *subtitle) {
if (subtitle->data->getMaxTime() > subtitle->sound->time) {
subtitle->status.status = kSoundStatus_400;
} else {
- subtitle->data->setTime(subtitle->sound->time);
+ subtitle->data->setTime((uint16)subtitle->sound->time);
if (_drawSubtitles & 1)
drawSubtitleOnScreen(subtitle);
@@ -1867,6 +1867,9 @@ void SoundManager::drawSubtitle(SubtitleEntry *subtitle) {
}
void SoundManager::drawSubtitleOnScreen(SubtitleEntry *subtitle) {
+ if (!subtitle)
+ error("SoundManager::drawSubtitleOnScreen: Invalid subtitle entry!");
+
_drawSubtitles &= ~1;
if (subtitle->data == NULL)
diff --git a/engines/lastexpress/game/sound.h b/engines/lastexpress/game/sound.h
index 9471e1f4ee..610eba9d5b 100644
--- a/engines/lastexpress/game/sound.h
+++ b/engines/lastexpress/game/sound.h
@@ -361,7 +361,7 @@ private:
void updateEntry(SoundEntry *entry, uint value) const;
void updateEntryState(SoundEntry *entry) const ;
- void resetEntry(SoundEntry *entry);
+ void resetEntry(SoundEntry *entry) const;
void removeEntry(SoundEntry *entry);
// Subtitles