aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-06-18 22:37:54 +0200
committeruruk2014-06-18 22:37:54 +0200
commitd85d3229e6a790e9d6caf3a422632d562dcc3e3f (patch)
tree7dfd2ee82858c0cc88b0f63aebedbe0b1436b67b
parentfb97e24a5adfb117add2cfa959c075a2af569fad (diff)
downloadscummvm-rg350-d85d3229e6a790e9d6caf3a422632d562dcc3e3f.tar.gz
scummvm-rg350-d85d3229e6a790e9d6caf3a422632d562dcc3e3f.tar.bz2
scummvm-rg350-d85d3229e6a790e9d6caf3a422632d562dcc3e3f.zip
CGE2: Implement functions connected to inventory handling.
Also move closePocket() closer to the others and fix the stub message in busy().
-rw-r--r--engines/cge2/cge2_main.cpp38
-rw-r--r--engines/cge2/snail.cpp5
2 files changed, 27 insertions, 16 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 5fa44531df..b17f48dacd 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -475,15 +475,6 @@ void CGE2Engine::sceneDown() {
_spare->dispose();
}
-void CGE2Engine::closePocket() {
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < kPocketMax + 1; j++) {
- Sprite *spr = _heroTab[i]->_pocket[j];
- _heroTab[i]->_pocket[j] = (Sprite*)((spr) ? spr->_ref : -1);
- }
- }
-}
-
void CGE2Engine::switchScene(int scene) {
if (scene == _now)
return;
@@ -607,15 +598,38 @@ void CGE2Engine::tick() {
}
void CGE2Engine::openPocket() {
- warning("STUB: CGE2Engine::openPocket()");
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < kPocketMax + 1; j++) {
+ int ref = (int)_heroTab[i]->_pocket[j];
+ _heroTab[i]->_pocket[j] = (ref == -1) ? nullptr : _vga->_showQ->locate(ref);
+ }
+ }
+}
+
+void CGE2Engine::closePocket() {
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < kPocketMax + 1; j++) {
+ Sprite *spr = _heroTab[i]->_pocket[j];
+ _heroTab[i]->_pocket[j] = (Sprite*)((spr) ? spr->_ref : -1);
+ }
+ }
}
+
void CGE2Engine::selectPocket(int n) {
- warning("STUB: CGE2Engine::selectPocket()");
+ Sprite **p = _heroTab[_sex]->_pocket;
+ int &pp = _heroTab[_sex]->_pocPtr;
+ if (n < 0 || pp == n) {
+ n = findActivePocket(-1);
+ if (n >= 0)
+ pp = n;
+ } else if (p[n]) {
+ pp = n;
+ }
}
void CGE2Engine::busy(bool on) {
- warning("STUB: CGE2Engine::selectPocket()");
+ warning("STUB: CGE2Engine::busy()");
}
void CGE2Engine::runGame() {
diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp
index e3c3baaccc..3a17168893 100644
--- a/engines/cge2/snail.cpp
+++ b/engines/cge2/snail.cpp
@@ -740,9 +740,6 @@ void CGE2Engine::feedSnail(Sprite *spr, Action snq, Hero *hero) {
CommandHandler::Command *c = &comtab[ptr];
CommandHandler::Command *q = &comtab[cnt];
- warning("STUB: CGE2Engine::feedSnail()");
- // Dont bother with pockets (inventory system) for now... TODO: Implement it later!!!
- /*
int pocFre = freePockets(hero->_ref & 1);
int pocReq = 0;
CommandHandler::Command *p = c;
@@ -771,7 +768,7 @@ void CGE2Engine::feedSnail(Sprite *spr, Action snq, Hero *hero) {
pocFul();
return;
}
- }*/
+ }
while (c < q) {
if (c->_commandType == kCmdTalk) {