aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-05-13 17:27:12 +0200
committeruruk2014-05-13 17:27:12 +0200
commitc202328ecf9fc244e0e3974c303056b811726af7 (patch)
tree3bafa6434974d8fe35c433aac1784fb4d8d862d0
parent4ee1ab07aea7d07a661b58770721f6edce4d5f18 (diff)
downloadscummvm-rg350-c202328ecf9fc244e0e3974c303056b811726af7.tar.gz
scummvm-rg350-c202328ecf9fc244e0e3974c303056b811726af7.tar.bz2
scummvm-rg350-c202328ecf9fc244e0e3974c303056b811726af7.zip
CGE2: Implement Sprite::setShapeList().
-rw-r--r--engines/cge2/vga13h.cpp31
-rw-r--r--engines/cge2/vga13h.h2
2 files changed, 32 insertions, 1 deletions
diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp
index 47b0d6fa0f..054769e93e 100644
--- a/engines/cge2/vga13h.cpp
+++ b/engines/cge2/vga13h.cpp
@@ -61,6 +61,17 @@ void(*Sprite::notify) (void) = nullptr;
byte Sprite::_constY = 0;
byte Sprite::_follow = 0;
+Seq Sprite::_stdSeq8[] =
+{ { 0, 0, 0, 0, 0, 0 },
+ { 1, 1, 0, 0, 0, 0 },
+ { 2, 2, 0, 0, 0, 0 },
+ { 3, 3, 0, 0, 0, 0 },
+ { 4, 4, 0, 0, 0, 0 },
+ { 5, 5, 0, 0, 0, 0 },
+ { 6, 6, 0, 0, 0, 0 },
+ { 7, 7, 0, 0, 0, 0 },
+};
+
Sprite::Sprite(CGE2Engine *vm)
: _siz(_vm, 0, 0), _seqPtr(kNoSeq), _seqCnt(0), _shpCnt(0),
_next(NULL), _prev(NULL), _time(0),
@@ -104,7 +115,25 @@ BitmapPtr Sprite::shp() {
}
void Sprite::setShapeList(BitmapPtr *shp, int cnt) {
- warning("STUB: Sprite::setShapeList()");
+ _shpCnt = cnt;
+ _siz.x = 0;
+ _siz.y = 0;
+
+ if (shp) {
+ for (int i = 0; i < cnt; i++) {
+ BitmapPtr p = *shp + i;
+ if (p->_w > _siz.x)
+ _siz.x = p->_w;
+ if (p->_h > _siz.y)
+ _siz.y = p->_w;
+ }
+ expand();
+ _ext->_shpList = shp;
+ if (!_ext->_seq) {
+ setSeq(_stdSeq8);
+ _seqCnt = (cnt < ARRAYSIZE(_stdSeq8)) ? cnt : ARRAYSIZE(_stdSeq8);
+ }
+ }
}
bool Sprite::works(Sprite *spr) {
diff --git a/engines/cge2/vga13h.h b/engines/cge2/vga13h.h
index 437cba05f1..f8c7bf462d 100644
--- a/engines/cge2/vga13h.h
+++ b/engines/cge2/vga13h.h
@@ -55,6 +55,7 @@ struct Seq {
uint8 _next;
int8 _dx;
int8 _dy;
+ int8 _dz;
int _dly;
};
@@ -114,6 +115,7 @@ public:
Sprite *_next;
static byte _constY;
static byte _follow;
+ static Seq _stdSeq8[];
bool works(Sprite *spr);
bool seqTest(int n);