aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2014-06-03 07:35:21 +0200
committerStrangerke2014-06-03 07:35:21 +0200
commit46d93eb780621392b563995c5c72ffb398e6206e (patch)
treefcbdae15a5536bbc03e8a2ec3e0e71a41236f708 /engines
parent41f9195f5608df90ab08f397678f064d4e785b5b (diff)
downloadscummvm-rg350-46d93eb780621392b563995c5c72ffb398e6206e.tar.gz
scummvm-rg350-46d93eb780621392b563995c5c72ffb398e6206e.tar.bz2
scummvm-rg350-46d93eb780621392b563995c5c72ffb398e6206e.zip
CGE2: Rework style in touch()
Diffstat (limited to 'engines')
-rw-r--r--engines/cge2/cge2_main.cpp92
1 files changed, 44 insertions, 48 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index cec22f24ad..64f39a37ea 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -844,59 +844,55 @@ void Sprite::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) {
if (_vm->isHero(this) && !_vm->_blinkSprite) {
_vm->switchHero(this == _vm->_heroTab[1]->_ptr);
- } else { // not HERO || sprite from pocket ready to use
- if (_flags._kept) { // sprite in pocket
- for (int sex = 0; sex < 2; sex++) {
- for (int p = 0; p < kPocketMax; p++) {
- if (_vm->_heroTab[sex]->_pocket[p] == this) {
- _vm->switchHero(sex);
- if (_vm->_sex == sex) {
- if (_vm->_blinkSprite)
- _vm->_blinkSprite->_flags._hide = false;
- if (_vm->_blinkSprite == this)
- _vm->_blinkSprite = nullptr;
- else
- _vm->_blinkSprite = this;
- }
+ } else if (_flags._kept) { // sprite in pocket
+ for (int sex = 0; sex < 2; sex++) {
+ for (int p = 0; p < kPocketMax; p++) {
+ if (_vm->_heroTab[sex]->_pocket[p] == this) {
+ _vm->switchHero(sex);
+ if (_vm->_sex == sex) {
+ if (_vm->_blinkSprite)
+ _vm->_blinkSprite->_flags._hide = false;
+ if (_vm->_blinkSprite == this)
+ _vm->_blinkSprite = nullptr;
+ else
+ _vm->_blinkSprite = this;
}
}
}
- } else { // sprite NOT in pocket
- Hero *h = _vm->_heroTab[_vm->_sex]->_ptr;
- if (!_vm->_talk) {
- if ((_ref & 0xFF) < 200 && h->distance(this) > (h->_maxDist << 1)) h->walkTo(this);
+ }
+ } else { // sprite NOT in pocket
+ Hero *h = _vm->_heroTab[_vm->_sex]->_ptr;
+ if (!_vm->_talk) {
+ if ((_ref & 0xFF) < 200 && h->distance(this) > (h->_maxDist << 1))
+ h->walkTo(this);
+ else if (_vm->_blinkSprite) {
+ if (works(_vm->_blinkSprite)) {
+ _vm->feedSnail(_vm->_blinkSprite, (_vm->_sex) ? kMTake : kFTake, _vm->_heroTab[_vm->_sex]->_ptr);
+ _vm->_blinkSprite->_flags._hide = false;
+ _vm->_blinkSprite = nullptr;
+ } else
+ _vm->offUse();
+
+ _vm->selectPocket(-1);
+ // else, no pocket sprite selected
+ } else if (_flags._port) { // portable
+ if (_vm->findActivePocket(-1) < 0)
+ _vm->pocFul();
else {
- if (_vm->_blinkSprite) {
- if (works(_vm->_blinkSprite)) {
- _vm->feedSnail(_vm->_blinkSprite, (_vm->_sex) ? kMTake : kFTake, _vm->_heroTab[_vm->_sex]->_ptr);
- _vm->_blinkSprite->_flags._hide = false;
- _vm->_blinkSprite = nullptr;
- } else
- _vm->offUse();
-
- _vm->selectPocket(-1);
- } else { // no pocket sprite selected
- if (_flags._port) { // portable
- if (_vm->findActivePocket(-1) < 0)
- _vm->pocFul();
- else {
- _vm->_commandHandler->addCommand(kCmdReach, -2, _ref, nullptr);
- _vm->_commandHandler->addCommand(kCmdKeep, -1, -1, this);
- _flags._port = false;
- }
- } else { // non-portable
- Action a = h->action();
- if (_actionCtrl[a]._cnt) {
- CommandHandler::Command *cmdList = snList(a);
- if (cmdList[_actionCtrl[a]._ptr]._commandType == kCmdNext)
- _vm->offUse();
- else
- _vm->feedSnail(this, a, h);
- } else
- _vm->offUse();
- }
- }
+ _vm->_commandHandler->addCommand(kCmdReach, -2, _ref, nullptr);
+ _vm->_commandHandler->addCommand(kCmdKeep, -1, -1, this);
+ _flags._port = false;
}
+ } else { // non-portable
+ Action a = h->action();
+ if (_actionCtrl[a]._cnt) {
+ CommandHandler::Command *cmdList = snList(a);
+ if (cmdList[_actionCtrl[a]._ptr]._commandType == kCmdNext)
+ _vm->offUse();
+ else
+ _vm->feedSnail(this, a, h);
+ } else
+ _vm->offUse();
}
}
}