CGE2: Revise Spare::takeCave().

This commit is contained in:
uruk 2014-05-19 17:56:19 +02:00
parent 63e57b2eb6
commit 06ed289509
3 changed files with 13 additions and 6 deletions

View File

@ -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()");

View File

@ -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) {

View File

@ -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);