aboutsummaryrefslogtreecommitdiff
path: root/engines/hugo/file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/hugo/file.cpp')
-rw-r--r--engines/hugo/file.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index a0e3ff05ce..ba4e420111 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -30,8 +30,10 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "common/config-manager.h"
#include "graphics/thumbnail.h"
#include "gui/saveload.h"
@@ -298,7 +300,11 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) {
}
if (!has_read_header) {
- if (fp.read(s_hdr, sizeof(s_hdr)) != sizeof(s_hdr))
+ for (int i = 0; i < kMaxSounds; i++) {
+ s_hdr[i].size = fp.readUint16LE();
+ s_hdr[i].offset = fp.readUint32LE();
+ }
+ if (fp.err())
error("Wrong sound file format");
has_read_header = true;
}
@@ -400,7 +406,7 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
out->writeByte((gameStatus.gameOverFl) ? 1 : 0);
// Save screen states
- for (int i = 0; i < _vm->_numScreens; i++)
+ for (int i = 0; i < _vm->_numStates; i++)
out->writeByte(_vm->_screenStates[i]);
_vm->_scheduler->saveSchedulerData(out);
@@ -497,7 +503,7 @@ bool FileManager::restoreGame(const int16 slot) {
gameStatus.storyModeFl = (in->readByte() == 1);
_vm->_mouse->setJumpExitFl(in->readByte() == 1);
gameStatus.gameOverFl = (in->readByte() == 1);
- for (int i = 0; i < _vm->_numScreens; i++)
+ for (int i = 0; i < _vm->_numStates; i++)
_vm->_screenStates[i] = in->readByte();
_vm->_scheduler->restoreSchedulerData(in);