aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorGregory Montoir2008-11-28 23:51:59 +0000
committerGregory Montoir2008-11-28 23:51:59 +0000
commit443c57146d74d7a92d1c9ec48c0f7eb8a497749b (patch)
tree5a6375854df2938a02bc5147abb66abd106f0c25 /graphics
parentb25257d4eb377b2c2e63af0783c2b6d5c1b364ab (diff)
downloadscummvm-rg350-443c57146d74d7a92d1c9ec48c0f7eb8a497749b.tar.gz
scummvm-rg350-443c57146d74d7a92d1c9ec48c0f7eb8a497749b.tar.bz2
scummvm-rg350-443c57146d74d7a92d1c9ec48c0f7eb8a497749b.zip
added load/closeFile to Graphics::FlicPlayer (matching DXAPlayer class)
svn-id: r35170
Diffstat (limited to 'graphics')
-rw-r--r--graphics/flic_player.cpp23
-rw-r--r--graphics/flic_player.h5
2 files changed, 22 insertions, 6 deletions
diff --git a/graphics/flic_player.cpp b/graphics/flic_player.cpp
index 19766d7af5..af32209279 100644
--- a/graphics/flic_player.cpp
+++ b/graphics/flic_player.cpp
@@ -27,12 +27,21 @@
namespace Graphics {
-FlicPlayer::FlicPlayer(const char *fileName)
+FlicPlayer::FlicPlayer()
: _paletteDirty(false), _offscreen(0), _currFrame(0) {
-
memset(&_flicInfo, 0, sizeof(_flicInfo));
- _fileStream.open(fileName);
- assert(_fileStream.isOpen());
+}
+
+FlicPlayer::~FlicPlayer() {
+ closeFile();
+}
+
+bool FlicPlayer::loadFile(const char *fileName) {
+ closeFile();
+
+ if (!_fileStream.open(fileName)) {
+ return false;
+ }
_flicInfo.size = _fileStream.readUint32LE();
_flicInfo.type = _fileStream.readUint16LE();
@@ -56,10 +65,14 @@ FlicPlayer::FlicPlayer(const char *fileName)
// Seek to the first frame
_fileStream.seek(_flicInfo.offsetFrame1);
+ return true;
}
-FlicPlayer::~FlicPlayer() {
+void FlicPlayer::closeFile() {
+ memset(&_flicInfo, 0, sizeof(_flicInfo));
+ _fileStream.close();
delete[] _offscreen;
+ _offscreen = 0;
}
void FlicPlayer::redraw() {
diff --git a/graphics/flic_player.h b/graphics/flic_player.h
index 64b29969c8..7d92a652d3 100644
--- a/graphics/flic_player.h
+++ b/graphics/flic_player.h
@@ -60,15 +60,18 @@ struct FrameTypeChunkHeader {
class FlicPlayer {
public:
- FlicPlayer(const char *fileName);
+ FlicPlayer();
~FlicPlayer();
+ bool loadFile(const char *fileName);
+ void closeFile();
void decodeFrame();
int getWidth() const { return _flicInfo.width; }
int getHeight() const { return _flicInfo.height; }
bool hasFrames() const { return _flicInfo.numFrames > 0; }
int getCurFrame() const { return _currFrame; }
int getFrameCount() const { return _flicInfo.numFrames; }
+ bool isLastFrame() const { return _currFrame == _flicInfo.numFrames; }
uint32 getSpeed() const { return _flicInfo.speed; }
bool isPaletteDirty() const { return _paletteDirty; }
const uint8 *getPalette() { _paletteDirty = false; return _palette; }