mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
CGE2: Implement Spare::dispose(), add Spare::update().
This commit is contained in:
parent
3e97ade388
commit
938a2e66c2
@ -58,16 +58,24 @@ void Spare::store(Sprite *spr) {
|
||||
_container.insert_at(_container.size(), spr);
|
||||
}
|
||||
|
||||
void Spare::dispose(Sprite *spr) {
|
||||
warning("STUB: Spare::Dispose()");
|
||||
void Spare::update(Sprite *spr) {
|
||||
Sprite *sp = locate(spr->_ref);
|
||||
if (sp == nullptr)
|
||||
store(spr);
|
||||
}
|
||||
|
||||
void Spare::dispose(Sprite *spr) {
|
||||
if (spr) {
|
||||
_vm->_vga->_showQ->remove(spr);
|
||||
|
||||
for (int i = 0; i < _container.size(); i++) {
|
||||
if (spr == _container[i]) {
|
||||
_container.remove_at(i);
|
||||
update(spr->contract());
|
||||
if (spr->_ref / 10 != 14) { // IIRC if it's == 14, it's the sprite of a Hero. No idea yet why it shouldn't be deleted then.
|
||||
for (int i = 0; i < _container.size(); i++) {
|
||||
if (spr == _container[i]) {
|
||||
_container.remove_at(i);
|
||||
}
|
||||
}
|
||||
|
||||
delete spr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
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 update(Sprite *spr);
|
||||
void dispose(Sprite *spr);
|
||||
void dispose(int ref);
|
||||
void dispose();
|
||||
|
Loading…
Reference in New Issue
Block a user