[Scummvm-cvs-logs] CVS: residual smush.cpp,1.34,1.35 smush.h,1.16,1.17 timer.cpp,1.3,1.4
Pawel Kolodziejski
aquadran at users.sourceforge.net
Thu Mar 25 13:26:01 CET 2004
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3113
Modified Files:
smush.cpp smush.h timer.cpp
Log Message:
maybe fix. tell me if it help
about previous _updateNeeded = true; hack, how is possible to need that ?
Index: smush.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- smush.cpp 22 Mar 2004 08:51:30 -0000 1.34
+++ smush.cpp 25 Mar 2004 21:14:28 -0000 1.35
@@ -28,6 +28,7 @@
#include "engine.h"
Smush *g_smush;
+extern SoundMixer *g_mixer;
void Smush::timerCallback(void *refCon) {
g_smush->handleFrame();
@@ -45,6 +46,7 @@
_videoFinished = false;
_videoPause = true;
_updateNeeded = false;
+ _stream = NULL;
_movieTime = 0;
_surface = NULL;
_bufSurface = NULL;
@@ -59,17 +61,12 @@
}
void Smush::init() {
+ _stream = NULL;
_frame = 0;
_movieTime = 0;
_videoFinished = false;
_videoPause = false;
-//HACK: If we don't set it here, it'll never get set at all..
-// This is BAD - but until we find the source of the problem, this'll have to do.
-#if defined(OSX) || defined(UNIX)
- _updateNeeded = true;
-#else
_updateNeeded = false;
-#endif
if (!_surface)
_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, _width, _height, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000);
if (!_bufSurface)
@@ -80,10 +77,14 @@
}
void Smush::deinit() {
+ g_timer->removeTimerProc(&timerCallback);
_videoFinished = true;
_videoPause = true;
- g_timer->removeTimerProc(&timerCallback);
- _file.close();
+ if (_stream) {
+ _stream->finish();
+ _stream = NULL;
+ }
+ _file.close();
}
void Smush::handleBlocky16(byte *src) {
@@ -110,9 +111,12 @@
if (_channels == 2)
flags |= SoundMixer::FLAG_STEREO;
- if (!_soundHandle.isActive())
- g_mixer->newStream(&_soundHandle, _freq, flags, 500000);
- g_mixer->appendStream(_soundHandle, (byte *)dst, size * _channels * 2);
+ if (!_stream) {
+ _stream = makeAppendableAudioStream(_freq, flags, 500000);
+ g_mixer->playInputStream(&_soundHandle, _stream, true);
+ }
+ if (_stream)
+ _stream->append((byte *)dst, size * _channels * 2);
}
void Smush::handleFrame() {
@@ -135,10 +139,12 @@
_file.readByte();
tag = _file.readUint32BE();
}
+
assert(tag == MKID_BE('FRME'));
size = _file.readUint32BE();
byte *frame = (byte*)malloc(size);
_file.read(frame, size);
+
do {
if (READ_BE_UINT32(frame + pos) == MKID_BE('Bl16')) {
handleBlocky16(frame + pos + 8);
@@ -177,6 +183,7 @@
size = _file.readUint32BE();
byte *f_header = (byte*)malloc(size);
_file.read(f_header, size);
+
do {
if (READ_BE_UINT32(f_header + pos) == MKID_BE('Bl16')) {
pos += READ_BE_UINT32(f_header + pos + 4) + 8;
@@ -193,30 +200,32 @@
}
bool Smush::setupAnim(const char *file, int x, int y) {
- if (!_file.open(file))
- return false;
-
uint32 tag;
int32 size;
+ if (!_file.open(file))
+ return false;
+
tag = _file.readUint32BE();
assert(tag == MKID_BE('SANM'));
+
size = _file.readUint32BE();
tag = _file.readUint32BE();
assert(tag == MKID_BE('SHDR'));
+
size = _file.readUint32BE();
byte *s_header = (byte *)malloc(size);
_file.read(s_header, size);
_nbframes = READ_LE_UINT32(s_header + 2);
- _x = x;
- _y = y;
+
int width = READ_LE_UINT16(s_header + 8);
int height = READ_LE_UINT16(s_header + 10);
-
if ((_width != width) || (_height != height)) {
_blocky16.init(width, height);
}
+ _x = x;
+ _y = y;
_width = width;
_height = height;
Index: smush.h
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- smush.h 20 Mar 2004 05:47:21 -0000 1.16
+++ smush.h 25 Mar 2004 21:14:29 -0000 1.17
@@ -25,6 +25,7 @@
#include "blocky16.h"
#include "mixer/mixer.h"
+#include "mixer/audiostream.h"
class zlibFile {
private:
@@ -54,8 +55,9 @@
Blocky16 _blocky16;
zlibFile _file;
PlayingSoundHandle _soundHandle;
-
- int32 _frame;
+ AppendableAudioStream *_stream;
+
+ int32 _frame;
bool _updateNeeded;
int32 _speed;
int32 _movieTime;
Index: timer.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/timer.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- timer.cpp 22 Mar 2004 12:11:42 -0000 1.3
+++ timer.cpp 25 Mar 2004 21:14:29 -0000 1.4
@@ -88,11 +88,7 @@
while (_timerSlots[l].counter <= 0) {
// A small paranoia check which catches the case where
// a timer removes itself (which it never should do).
- if (!_timerSlots[l].procedure || _timerSlots[l].interval <= 0) {
- warning("Timer Assert should have triggered");
- return 0;
- }
- //assert(_timerSlots[l].procedure && _timerSlots[l].interval > 0);
+ assert(_timerSlots[l].procedure && _timerSlots[l].interval > 0);
_timerSlots[l].counter += _timerSlots[l].interval;
_timerSlots[l].procedure(_timerSlots[l].refCon);
}
More information about the Scummvm-git-logs
mailing list