diff options
author | Nicola Mettifogo | 2008-02-03 10:48:07 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-02-03 10:48:07 +0000 |
commit | 748a90ca23e4a6554af6bc440f2d27a224cfbfa4 (patch) | |
tree | b6dd9075b787f1ce928ace43c52cb901ea279269 | |
parent | e51bf8021851d91f4904bd73263a455367d99b34 (diff) | |
download | scummvm-rg350-748a90ca23e4a6554af6bc440f2d27a224cfbfa4.tar.gz scummvm-rg350-748a90ca23e4a6554af6bc440f2d27a224cfbfa4.tar.bz2 scummvm-rg350-748a90ca23e4a6554af6bc440f2d27a224cfbfa4.zip |
Added code to unpack and render animations in BRA.
svn-id: r30755
-rw-r--r-- | engines/parallaction/disk_br.cpp | 11 | ||||
-rw-r--r-- | engines/parallaction/gfxbase.cpp | 14 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 24 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 33 | ||||
-rw-r--r-- | engines/parallaction/parallaction_br.cpp | 8 |
5 files changed, 87 insertions, 3 deletions
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index be8c49f829..69d28d57c2 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -73,7 +73,16 @@ struct Sprites : public Frames { 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; + } + }; diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp index ae14dd3ae7..c1085299d8 100644 --- a/engines/parallaction/gfxbase.cpp +++ b/engines/parallaction/gfxbase.cpp @@ -28,6 +28,7 @@ #include "disk.h" #include "common/algorithm.h" +#include "parallaction/parallaction.h" namespace Parallaction { @@ -68,6 +69,13 @@ byte *GfxObj::getData(uint f) { 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 @@ void Gfx::drawGfxObjects(Graphics::Surface &surf) { 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); + } } } } diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 59447c3974..dd5ae4349b 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -422,6 +422,30 @@ void Gfx::invertBackground(const Common::Rect& r) { } +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; diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 27598c2415..ce4cca0d1a 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -78,6 +78,8 @@ struct Frames { 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 @@ public: 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 @@ struct SurfaceToMultiFrames : public Frames { 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 @@ public: 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,6 +375,9 @@ public: 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); @@ -540,6 +572,7 @@ protected: 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); }; diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index 60f6bfe329..9415a7e671 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -206,8 +206,14 @@ void Parallaction_br::changeLocation(char *location) { // 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); |