[Scummvm-cvs-logs] SF.net SVN: scummvm: [32131] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Thu May 15 01:58:26 CEST 2008
Revision: 32131
http://scummvm.svn.sourceforge.net/scummvm/?rev=32131&view=rev
Author: drmccoy
Date: 2008-05-14 16:58:26 -0700 (Wed, 14 May 2008)
Log Message:
-----------
This should fix the video not closing / chunk slot clogging bug (Yeah, I'm apparently stupid *g*)
Modified Paths:
--------------
scummvm/trunk/engines/gob/videoplayer.cpp
scummvm/trunk/engines/gob/videoplayer.h
Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp 2008-05-14 23:47:07 UTC (rev 32130)
+++ scummvm/trunk/engines/gob/videoplayer.cpp 2008-05-14 23:58:26 UTC (rev 32131)
@@ -348,15 +348,30 @@
video->getVideo()->setVideoMemory();
video->getVideo()->enableSound(*_vm->_mixer);
- _videoSlots.push_back(video);
+ int slot = getNextFreeSlot();
+ _videoSlots[slot] = video;
+
WRITE_VAR(7, video->getVideo()->getFramesCount());
- return _videoSlots.size() - 1;
+ return slot;
}
+int VideoPlayer::getNextFreeSlot() {
+ uint slot;
+
+ for (slot = 0; slot < _videoSlots.size(); slot++)
+ if (!_videoSlots[slot])
+ break;
+
+ if (slot == _videoSlots.size())
+ _videoSlots.push_back(0);
+
+ return slot;
+}
+
void VideoPlayer::slotPlay(int slot, int16 frame) {
- if ((slot < 0) || (((uint) slot) >= _videoSlots.size()))
+ if ((slot < 0) || (((uint) slot) >= _videoSlots.size()) || !_videoSlots[slot])
return;
CoktelVideo &video = *(_videoSlots[slot]->getVideo());
@@ -377,18 +392,18 @@
}
void VideoPlayer::slotClose(int slot) {
- if ((slot < 0) || (((uint) slot) >= _videoSlots.size()))
+ if ((slot < 0) || (((uint) slot) >= _videoSlots.size()) || !_videoSlots[slot])
return;
delete _videoSlots[slot];
- _videoSlots.remove_at(slot);
+ _videoSlots[slot] = 0;
}
void VideoPlayer::slotCopyFrame(int slot, byte *dest,
uint16 left, uint16 top, uint16 width, uint16 height,
uint16 x, uint16 y, uint16 pitch, int16 transp) {
- if ((slot < 0) || (((uint) slot) >= _videoSlots.size()))
+ if ((slot < 0) || (((uint) slot) >= _videoSlots.size()) || !_videoSlots[slot])
return;
_videoSlots[slot]->getVideo()->copyCurrentFrame(dest,
@@ -396,14 +411,14 @@
}
void VideoPlayer::slotCopyPalette(int slot, int16 palStart, int16 palEnd) {
- if ((slot < 0) || (((uint) slot) >= _videoSlots.size()))
+ if ((slot < 0) || (((uint) slot) >= _videoSlots.size()) || !_videoSlots[slot])
return;
copyPalette(*(_videoSlots[slot]->getVideo()), palStart, palEnd);
}
void VideoPlayer::slotWaitEndFrame(int slot, bool onlySound) {
- if ((slot < 0) || (((uint) slot) >= _videoSlots.size()))
+ if ((slot < 0) || (((uint) slot) >= _videoSlots.size()) || !_videoSlots[slot])
return;
CoktelVideo &video = *(_videoSlots[slot]->getVideo());
@@ -413,7 +428,7 @@
}
bool VideoPlayer::slotIsOpen(int slot) const {
- if ((slot >= 0) && (((uint) slot) < _videoSlots.size()))
+ if ((slot >= 0) && (((uint) slot) < _videoSlots.size()) && _videoSlots[slot])
return true;
return false;
@@ -423,7 +438,7 @@
if (slot < 0) {
if (_primaryVideo->isOpen())
return _primaryVideo;
- } else if (((uint) slot) < _videoSlots.size())
+ } else if (((uint) slot) < _videoSlots.size() && _videoSlots[slot])
return _videoSlots[slot];
return 0;
Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h 2008-05-14 23:47:07 UTC (rev 32130)
+++ scummvm/trunk/engines/gob/videoplayer.h 2008-05-14 23:58:26 UTC (rev 32131)
@@ -128,6 +128,8 @@
const Video *getVideoBySlot(int slot = -1) const;
+ int getNextFreeSlot();
+
void copyPalette(CoktelVideo &video, int16 palStart = -1, int16 palEnd = -1);
bool doPlay(int16 frame, int16 breakKey,
uint16 palCmd, int16 palStart, int16 palEnd,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list