[Scummvm-cvs-logs] SF.net SVN: scummvm: [30755] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun Feb 3 11:48:08 CET 2008
Revision: 30755
http://scummvm.svn.sourceforge.net/scummvm/?rev=30755&view=rev
Author: peres001
Date: 2008-02-03 02:48:07 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
Added code to unpack and render animations in BRA.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/disk_br.cpp
scummvm/trunk/engines/parallaction/gfxbase.cpp
scummvm/trunk/engines/parallaction/graphics.cpp
scummvm/trunk/engines/parallaction/graphics.h
scummvm/trunk/engines/parallaction/parallaction_br.cpp
Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp 2008-02-03 10:15:36 UTC (rev 30754)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp 2008-02-03 10:48:07 UTC (rev 30755)
@@ -73,8 +73,17 @@
r.setWidth(_sprites[index].w);
r.setHeight(_sprites[index].h);
r.moveTo(_sprites[index].x, _sprites[index].y);
-}
+ }
+ uint getRawSize(uint16 index) {
+ assert(index < _num);
+ return _sprites[index].size;
+ }
+ uint getSize(uint16 index) {
+ assert(index < _num);
+ return _sprites[index].w * _sprites[index].h;
+ }
+
};
Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp 2008-02-03 10:15:36 UTC (rev 30754)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp 2008-02-03 10:48:07 UTC (rev 30755)
@@ -28,6 +28,7 @@
#include "disk.h"
#include "common/algorithm.h"
+#include "parallaction/parallaction.h"
namespace Parallaction {
@@ -68,7 +69,14 @@
return _frames->getData(f);
}
+uint GfxObj::getRawSize(uint f) {
+ return _frames->getRawSize(f);
+}
+uint GfxObj::getSize(uint f) {
+ return _frames->getSize(f);
+}
+
void GfxObj::setFlags(uint32 flags) {
_flags |= flags;
}
@@ -157,7 +165,11 @@
obj->getRect(obj->frame, rect);
rect.moveTo(obj->x, obj->y);
data = obj->getData(obj->frame);
- blt(rect, data, &surf, obj->layer, 0);
+ if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {
+ blt(rect, data, &surf, obj->layer, 0);
+ } else {
+ unpackBlt(rect, data, obj->getRawSize(obj->frame), &surf, obj->layer, 0);
+ }
}
}
}
Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp 2008-02-03 10:15:36 UTC (rev 30754)
+++ scummvm/trunk/engines/parallaction/graphics.cpp 2008-02-03 10:48:07 UTC (rev 30755)
@@ -422,6 +422,30 @@
}
+byte _unpackedBitmap[320*200];
+
+void Gfx::unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, byte transparentColor) {
+
+ byte *d = _unpackedBitmap;
+
+ while (size > 0) {
+
+ uint8 p = *data++;
+ size--;
+ uint8 color = p & 0xF;
+ uint8 repeat = (p & 0xF0) >> 4;
+ if (repeat == 0) {
+ repeat = *data++;
+ size--;
+ }
+
+ memset(d, color, repeat);
+ d += repeat;
+ }
+
+ blt(r, _unpackedBitmap, surf, z, transparentColor);
+}
+
void Gfx::blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor) {
Common::Point dp;
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2008-02-03 10:15:36 UTC (rev 30754)
+++ scummvm/trunk/engines/parallaction/graphics.h 2008-02-03 10:48:07 UTC (rev 30755)
@@ -78,6 +78,8 @@
virtual uint16 getNum() = 0;
virtual byte* getData(uint16 index) = 0;
virtual void getRect(uint16 index, Common::Rect &r) = 0;
+ virtual uint getRawSize(uint16 index) = 0;
+ virtual uint getSize(uint16 index) = 0;
virtual ~Frames() { }
@@ -110,6 +112,15 @@
r.setWidth(_surf->w);
r.setHeight(_surf->h);
}
+ uint getRawSize(uint16 index) {
+ assert(index == 0);
+ return getSize(index);
+ }
+ uint getSize(uint16 index) {
+ assert(index == 0);
+ return _surf->w * _surf->h;
+ }
+
};
/*
@@ -144,6 +155,15 @@
r.setWidth(_width);
r.setHeight(_height);
}
+ uint getRawSize(uint16 index) {
+ assert(index == 0);
+ return getSize(index);
+ }
+ uint getSize(uint16 index) {
+ assert(index == 0);
+ return _width * _height;
+ }
+
};
struct MaskBuffer {
@@ -284,6 +304,15 @@
r.setWidth(_width);
r.setHeight(_height);
}
+ uint getRawSize(uint16 index) {
+ assert(index < _count);
+ return getSize(index);
+ }
+ uint getSize(uint16 index) {
+ assert(index < _count);
+ return _width * _height;
+ }
+
};
@@ -346,7 +375,10 @@
uint getNum();
void getRect(uint frame, Common::Rect &r);
byte *getData(uint frame);
+ uint getRawSize(uint frame);
+ uint getSize(uint frame);
+
void setFlags(uint32 flags);
void clearFlags(uint32 flags);
bool isVisible() {
@@ -540,6 +572,7 @@
void drawWrappedText(Graphics::Surface* surf, char *text, byte color, int16 wrapwidth);
void blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, byte transparentColor);
+ void unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, byte transparentColor);
};
Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp 2008-02-03 10:15:36 UTC (rev 30754)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp 2008-02-03 10:48:07 UTC (rev 30755)
@@ -206,8 +206,14 @@
// free open location stuff
clearSubtitles();
+ freeBackground();
+ freeZones();
+// freeAnimations();
+// free(_location._comment);
+// _location._comment = 0;
+// _location._commands.clear();
+// _location._aCommands.clear();
- freeLocation();
// load new location
parseLocation(location);
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