diff options
author | Max Horn | 2002-10-21 12:34:54 +0000 |
---|---|---|
committer | Max Horn | 2002-10-21 12:34:54 +0000 |
commit | 31c773923ee34e05c06a7c00b784b924eff526fb (patch) | |
tree | b2d1e5e7aa5fff558b314162651f3c365ba61b2b /simon | |
parent | 46a3039f701dd40e2347d4c5090e0a3c74489a37 (diff) | |
download | scummvm-rg350-31c773923ee34e05c06a7c00b784b924eff526fb.tar.gz scummvm-rg350-31c773923ee34e05c06a7c00b784b924eff526fb.tar.bz2 scummvm-rg350-31c773923ee34e05c06a7c00b784b924eff526fb.zip |
use File::size() method were it makes sense; one small change to simon.cpp based on comment on bug #595813
svn-id: r5210
Diffstat (limited to 'simon')
-rw-r--r-- | simon/res.cpp | 8 | ||||
-rw-r--r-- | simon/simon.cpp | 27 |
2 files changed, 8 insertions, 27 deletions
diff --git a/simon/res.cpp b/simon/res.cpp index 705504c2a4..ad66db8895 100644 --- a/simon/res.cpp +++ b/simon/res.cpp @@ -123,13 +123,11 @@ bool SimonState::loadGamePcFile(const char *filename) if (in->isOpen() == false) return false; - in->seek(0, SEEK_END); - file_size = in->pos(); + file_size = in->size(); _tbl_list = (byte *)malloc(file_size); if (_tbl_list == NULL) error("Out of memory for strip table list"); - in->seek(0, SEEK_SET); in->read(_tbl_list, file_size); in->close(); @@ -143,12 +141,10 @@ bool SimonState::loadGamePcFile(const char *filename) if (in->isOpen() == false) return false; - in->seek(0, SEEK_END); - file_size = in->pos(); + file_size = in->size(); _stripped_txt_mem = (byte *)malloc(file_size); if (_stripped_txt_mem == NULL) error("Out of memory for strip text list"); - in->seek(0, SEEK_SET); in->read(_stripped_txt_mem, file_size); in->close(); diff --git a/simon/simon.cpp b/simon/simon.cpp index fc5a7906d5..be02131988 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -869,9 +869,7 @@ uint SimonState::loadTextFile_simon1(const char *filename, byte *dst) if (fo.isOpen() == false) error("loadTextFile: Cannot open '%s'", filename); - fo.seek(0, SEEK_END); - size = fo.pos(); - fo.seek(0, SEEK_SET); + size = fo.size(); if (fo.read(dst, size) != size) error("loadTextFile: fread failed"); @@ -1421,15 +1419,12 @@ void SimonState::loadIconFile() if (in.isOpen() == false) error("Cannot open icon.dat"); - in.seek(0, SEEK_END); - size = in.pos(); + size = in.size(); _icon_file_ptr = (byte *)malloc(size); if (_icon_file_ptr == NULL) error("Out of icon memory"); - in.seek(0, SEEK_SET); - in.read(_icon_file_ptr, size); in.close(); } @@ -3276,10 +3271,7 @@ void SimonState::readSfxFile(const char *filename) return; } - in.seek(0, SEEK_END); - size = in.pos(); - - in.seek(0, SEEK_SET); + size = in.size(); /* stop all sounds */ _mixer->stopAll(); @@ -4036,9 +4028,7 @@ void SimonState::read_vga_from_datfile_1(uint vga_id) return; } - in.seek(0, SEEK_END); - size = in.pos(); - in.seek(0, SEEK_SET); + size = in.size(); if (in.read(_vga_buffer_pointers[11].vgaFile2, size) != size) error("read_vga_from_datfile_1: read failed"); @@ -4066,9 +4056,7 @@ byte *SimonState::read_vga_from_datfile_2(uint id) if (in.isOpen() == false) error("read_vga_from_datfile_2: cannot open %s", buf); - in.seek(0, SEEK_END); - size = in.pos(); - in.seek(0, SEEK_SET); + size = in.size(); dst = setup_vga_destination(size); @@ -4880,10 +4868,7 @@ void SimonState::playMusic(uint music) /* FIXME: not properly implemented */ if (_game & GAME_WIN) { - int32 offset = _game_offsets_ptr[gss->MUSIC_INDEX_BASE + music]; - if (_game & GAME_SIMON2) - offset--; - _game_file->seek(offset, SEEK_SET); + _game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET); File *f = _game_file; midi.read_all_songs(f); } else { |