aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2014-07-15 16:22:43 +0200
committeruruk2014-07-15 16:22:43 +0200
commit8fae34df055ecc90cce6324a8c9eb09112e21e31 (patch)
treed5b0ebbaca598c65ed2a529e059c0259a8baf153 /engines
parentd9471679319e5a5bbc61c71fc3a07548d242fe6d (diff)
downloadscummvm-rg350-8fae34df055ecc90cce6324a8c9eb09112e21e31.tar.gz
scummvm-rg350-8fae34df055ecc90cce6324a8c9eb09112e21e31.tar.bz2
scummvm-rg350-8fae34df055ecc90cce6324a8c9eb09112e21e31.zip
CGE2: Implement snRoom().
Diffstat (limited to 'engines')
-rw-r--r--engines/cge2/cge2.h2
-rw-r--r--engines/cge2/snail.cpp23
2 files changed, 22 insertions, 3 deletions
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index d97ba3d675..b152b617d3 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -246,7 +246,7 @@ public:
void snWalk(Sprite *spr, int val);
void snReach(Sprite *spr, int val);
void snSound(Sprite *spr, int wav);
- void snRoom(Sprite *spr, int val);
+ void snRoom(Sprite *spr, bool on);
void snDim(Sprite *spr, int val);
void snGhost(Bitmap *bmp);
void snSay(Sprite *spr, int val);
diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp
index 7ba0c3638e..284cecff3f 100644
--- a/engines/cge2/snail.cpp
+++ b/engines/cge2/snail.cpp
@@ -688,8 +688,27 @@ void CGE2Engine::snSound(Sprite *spr, int wav) {
_sound->setRepeat(1);
}
-void CGE2Engine::snRoom(Sprite *spr, int val) {
- warning("STUB: CGE2Engine::snRoom()");
+void CGE2Engine::snRoom(Sprite *spr, bool on) {
+ if (!isHero(spr))
+ return;
+ int sx = spr->_ref & 1;
+ Sprite **p = _heroTab[sx]->_pocket;
+ if (on) {
+ if (freePockets(sx) == 0 && p[kPocketMax] == nullptr) {
+ SWAP(p[kPocketMax], p[kPocketMax - 1]);
+ snHide(p[kPocketMax], 1);
+ }
+ } else {
+ if (p[kPocketMax]) {
+ for (int i = 0; i < kPocketMax; i++) {
+ if (p[i] == nullptr) {
+ snHide(p[kPocketMax], 0);
+ SWAP(p[kPocketMax], p[i]);
+ break;
+ }
+ }
+ }
+ }
}
void CGE2Engine::snDim(Sprite *spr, int val) {