diff options
author | uruk | 2014-05-18 14:18:45 +0200 |
---|---|---|
committer | uruk | 2014-05-18 14:18:45 +0200 |
commit | 122db4053023ab18ef957585fa31361a0dec8922 (patch) | |
tree | 4b8d7a1d2564aefa583b87d221b8e6312fef647a | |
parent | 47e55f16646403a1dea870231e4f294c0858b9a7 (diff) | |
download | scummvm-rg350-122db4053023ab18ef957585fa31361a0dec8922.tar.gz scummvm-rg350-122db4053023ab18ef957585fa31361a0dec8922.tar.bz2 scummvm-rg350-122db4053023ab18ef957585fa31361a0dec8922.zip |
CGE2: Implement Sprite::contract():
-rw-r--r-- | engines/cge2/vga13h.cpp | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index 51a8c107ef..57c84e020e 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -297,26 +297,41 @@ Sprite *Sprite::expand() { } Sprite *Sprite::contract() { - //SprExt *e = _ext; - //if (!e) - // return this; - - //if (e->_name) - // delete[] e->_name; - //if (_flags._bDel && e->_shpList) { - // for (int i = 0; e->_shpList[i]; i++) - // delete e->_shpList[i]; - // delete[] e->_shpList; - //} + SprExt *e = _ext; + if (!e) + return this; - //free(e->_seq); - //free(e->_near); - //free(e->_take); + if (_file[2] == '~') { // FLY-type sprite + Seq *seq = _ext->_seq; + // return to middle + gotoxyz(_pos3D - V3D(seq->_dx, seq->_dy, seq->_dz)); + seq->_dx = seq->_dy = seq->_dz = 0; + } - //delete e; - //_ext = NULL; + if (notify) + notify(); - warning("STUB: Sprite::contract()"); + if (e->_name) + delete[] e->_name; + + if (e->_shpList) { + for (int i = 0; i < _shpCnt; i++) + e->_shpList[i]->release(); + delete[] e->_shpList; + } + + if (e->_seq) { + if (e->_seq == _stdSeq8) + _seqCnt = 0; + else + delete[] e->_seq; + } + + for (int i = 0; i < kActions; i++) + if (e->_actions[i]) + delete[] e->_actions[i]; + + _ext = nullptr; return this; } @@ -379,7 +394,7 @@ void Sprite::gotoxyz(V2D pos) { rem = (rem * V2D::trunc(_vm->_eye->_z) / (V2D::trunc(_vm->_eye->_z) - z)); ctr = (ctr * 3) / 4; rem = (rem * 3) / 4; - } + } if (pos.x - ctr < 0) { pos.x = ctr; |