From 2514d866301ca9c9bcc26b54031889e2a0e5a28d Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 27 Jun 2014 23:40:23 +0200 Subject: CGE2: Implement Sprite::step() fully. --- engines/cge2/vga13h.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index 9507ade704..29ee5c8b44 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -492,7 +492,36 @@ void Sprite::step(int nr) { _seqPtr = _ext->_seq[_seqPtr]._next; if (_file[2] == '~') { // FLY-type sprite - warning("STUB: Sprite::step() - FLY-type sprite"); + seq = _ext->_seq; + // return to middle + p._x -= seq->_dx; + p._y -= seq->_dy; + p._z -= seq->_dz; + // generate motion + if (_vm->newRandom(10) < 5) { + if ((seq + 1)->_dx) + seq->_dx += _vm->newRandom(3) - 1; + if ((seq + 1)->_dy) + seq->_dy += _vm->newRandom(3) - 1; + if ((seq + 1)->_dz) + seq->_dz += _vm->newRandom(3) - 1; + } + if (seq->_dx < -(seq + 1)->_dx) + seq->_dx += 2; + if (seq->_dx >= (seq + 1)->_dx) + seq->_dx -= 2; + if (seq->_dy < -(seq + 1)->_dy) + seq->_dy += 2; + if (seq->_dy >= (seq + 1)->_dy) + seq->_dy -= 2; + if (seq->_dz < -(seq + 1)->_dz) + seq->_dz += 2; + if (seq->_dz >= (seq + 1)->_dz) + seq->_dz -= 2; + p._x += seq->_dx; + p._y += seq->_dy; + p._z += seq->_dz; + gotoxyz(p); } else { seq = _ext->_seq + _seqPtr; if (seq->_dz == 127 && seq->_dx != 0) { -- cgit v1.2.3