diff options
author | uruk | 2014-07-15 23:12:58 +0200 |
---|---|---|
committer | uruk | 2014-07-15 23:12:58 +0200 |
commit | 7d6c02ce3f3e05b72538ca0b0a169dbf4868caef (patch) | |
tree | 4934718fa2e8bda0b477a863c8bbe24fab75a7b7 /engines/cge2 | |
parent | 0b0f998aacb1d8804e8cdf2679df69966a643c41 (diff) | |
download | scummvm-rg350-7d6c02ce3f3e05b72538ca0b0a169dbf4868caef.tar.gz scummvm-rg350-7d6c02ce3f3e05b72538ca0b0a169dbf4868caef.tar.bz2 scummvm-rg350-7d6c02ce3f3e05b72538ca0b0a169dbf4868caef.zip |
CGE2: Add Hero::contract().
Fix the crash introduced by previous commit on the second scene.
Diffstat (limited to 'engines/cge2')
-rw-r--r-- | engines/cge2/hero.cpp | 13 | ||||
-rw-r--r-- | engines/cge2/hero.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp index 0a72178fe7..cebfe73295 100644 --- a/engines/cge2/hero.cpp +++ b/engines/cge2/hero.cpp @@ -207,6 +207,19 @@ Sprite *Hero::expand() { // It's very similar to Sprite's expand, but doesn't bo return this; } +Sprite *Hero::contract() { + for (int i = 0; i < kDimMax; i++) { + if (_dim[i] != nullptr) { + delete[] _dim[i]; + if (_ext->_shpList == _dim[i]) + _ext->_shpList = nullptr; + _dim[i] = nullptr; + } + } + Sprite::contract(); + return this; +} + void Hero::setCurrent() { FXP m = _vm->_eye->_z / (_pos3D._z - _vm->_eye->_z); FXP tmp = m * _siz.y; diff --git a/engines/cge2/hero.h b/engines/cge2/hero.h index e8cce711f4..c277b4a780 100644 --- a/engines/cge2/hero.h +++ b/engines/cge2/hero.h @@ -77,6 +77,7 @@ public: Hero(CGE2Engine *vm); void tick(); Sprite *expand(); + Sprite *contract(); Sprite *setContact(); int stepSize() { return _ext->_seq[7]._dx; } int distance(V3D pos); |