diff options
author | uruk | 2014-05-19 17:56:19 +0200 |
---|---|---|
committer | uruk | 2014-05-19 17:56:19 +0200 |
commit | 06ed289509f7d9d164bddebee0c1ef85b864deef (patch) | |
tree | 118c6673d07a48e03d7ae6aded8460fad7edd8a8 | |
parent | 63e57b2eb62c7c3fe2a1b4d878da5941648b6603 (diff) | |
download | scummvm-rg350-06ed289509f7d9d164bddebee0c1ef85b864deef.tar.gz scummvm-rg350-06ed289509f7d9d164bddebee0c1ef85b864deef.tar.bz2 scummvm-rg350-06ed289509f7d9d164bddebee0c1ef85b864deef.zip |
CGE2: Revise Spare::takeCave().
-rw-r--r-- | engines/cge2/cge2_main.cpp | 3 | ||||
-rw-r--r-- | engines/cge2/spare.cpp | 14 | ||||
-rw-r--r-- | engines/cge2/spare.h | 2 |
3 files changed, 13 insertions, 6 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index a20dbb6cfd..4ea069a356 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -208,6 +208,7 @@ void CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos) { if (_sprite) { _sprite->_ref = ref; + _sprite->_scene = scene; _sprite->_flags._frnt = frnt; _sprite->_flags._east = east; @@ -338,7 +339,7 @@ void CGE2Engine::caveUp(int cav) { showBak(bakRef); _eye = _eyeTab[_now]; _mouseTop = V2D(this, V3D(0, 1, kScrDepth)).y; - _spare->takeCave(bakRef); + _spare->takeCave(_now); openPocket(); warning("STUB: CGE2Engine::caveUp()"); diff --git a/engines/cge2/spare.cpp b/engines/cge2/spare.cpp index 4c66e96285..dbd8425eed 100644 --- a/engines/cge2/spare.cpp +++ b/engines/cge2/spare.cpp @@ -48,10 +48,16 @@ Sprite *Spare::locate(int ref) { return nullptr; } -void Spare::takeCave(int ref) { - Sprite *spr = locate(ref); - if (spr != nullptr) - _vm->_vga->_showQ->insert(spr); +void Spare::takeCave(int cav) { + int bakRef = cav << 8; + Common::Array<Sprite*> tempCont = _container; + for (int i = 0; i < tempCont.size(); i++) { + Sprite *spr = tempCont[i]; + int c = spr->_scene; + if ((c == _vm->_now || c == 0) && spr->_ref != bakRef) { + _vm->_vga->_showQ->insert(spr); + } + } } void Spare::store(Sprite *spr) { diff --git a/engines/cge2/spare.h b/engines/cge2/spare.h index 6e8f8c5987..7bd520d9d0 100644 --- a/engines/cge2/spare.h +++ b/engines/cge2/spare.h @@ -40,7 +40,7 @@ public: ~Spare() { clear(); } void store(Sprite *spr); Sprite *locate(int ref); - void takeCave(int ref); // Note that it takes the ref of the sprite now, not the number of the scene, like the original! + void takeCave(int cav); void update(Sprite *spr); void dispose(Sprite *spr); void dispose(int ref); |