aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-06-18 22:58:33 +0200
committeruruk2014-06-18 22:58:33 +0200
commitea5697d5a0ff66c7e93db4e53c881980df0a5971 (patch)
tree51b681d62acee36c94c4c504d205d3b37c87869b
parentd85d3229e6a790e9d6caf3a422632d562dcc3e3f (diff)
downloadscummvm-rg350-ea5697d5a0ff66c7e93db4e53c881980df0a5971.tar.gz
scummvm-rg350-ea5697d5a0ff66c7e93db4e53c881980df0a5971.tar.bz2
scummvm-rg350-ea5697d5a0ff66c7e93db4e53c881980df0a5971.zip
CGE2: Implement snKeep().
Now the inventory system is (at least partially) working.
-rw-r--r--engines/cge2/snail.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp
index 3a17168893..d40789c6d1 100644
--- a/engines/cge2/snail.cpp
+++ b/engines/cge2/snail.cpp
@@ -469,8 +469,39 @@ void CGE2Engine::snFocus(int val) {
warning("STUB: CGE2Engine::snFocus()");
}
-void CGE2Engine::snKeep(Sprite *spr, int val) {
- warning("STUB: CGE2Engine::snKeep()");
+void CGE2Engine::snKeep(Sprite *spr, int stp) {
+ int sex = _sex;
+ if (stp > 127) {
+ _sex = stp & 1; // for another hero
+ stp = -1;
+ }
+ HeroTab *ht = _heroTab[_sex];
+ selectPocket(-1);
+ int pp = ht->_pocPtr;
+
+ if (spr && !spr->_flags._kept && ht->_pocket[pp] == nullptr) {
+ V3D pos(14, -10, -1);
+ snSound(ht->_ptr, 3);
+ if (_taken) {
+ _vga->_showQ->insert(spr);
+ _taken = false;
+ }
+ ht->_pocket[pp] = spr;
+ spr->setScene(0);
+ spr->_flags._kept = true;
+ if (!_sex)
+ pos._x += kScrWidth - 58;
+ if (pp & 1)
+ pos._x += 29;
+ if (pp >> 1)
+ pos._y -= 20;
+ pos._y -= (spr->_siz.y / 2);
+ spr->gotoxyz(pos);
+ if (stp >= 0)
+ spr->step(stp);
+ }
+ _sex = sex;
+ selectPocket(-1);
}
void CGE2Engine::snGive(Sprite *spr, int val) {