diff options
author | uruk | 2014-06-02 14:46:59 +0200 |
---|---|---|
committer | uruk | 2014-06-02 14:46:59 +0200 |
commit | 6d73870431d0a713520f09d7d8eb4f4512651f23 (patch) | |
tree | afc17306f51ac4e5b2e213dbd522a2db3d21f525 /engines/cge2/cge2_main.cpp | |
parent | 87db3d2d750c3c609ded7576f14e35a22f96f849 (diff) | |
download | scummvm-rg350-6d73870431d0a713520f09d7d8eb4f4512651f23.tar.gz scummvm-rg350-6d73870431d0a713520f09d7d8eb4f4512651f23.tar.bz2 scummvm-rg350-6d73870431d0a713520f09d7d8eb4f4512651f23.zip |
CGE2: Move then implement Sprite::touch().
Also add stubs for called functions.
Diffstat (limited to 'engines/cge2/cge2_main.cpp')
-rw-r--r-- | engines/cge2/cge2_main.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index 78d743596b..cec22f24ad 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -826,4 +826,89 @@ Sprite *CGE2Engine::spriteAt(int x, int y) { return spr; } +#pragma argsused +void Sprite::touch(uint16 mask, int x, int y, Common::KeyCode keyCode) { + if ((mask & kEventAttn) != 0) + return; + + if (!_vm->_startupMode) + _vm->_infoLine->setText(name()); + + if (_ref < 0) + return; // cannot access system sprites + + if (_ref / 10 == 12) { + _vm->optionTouch(_ref % 10, mask); + return; + } + + 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 { // 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 + 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(); + } + } + } + } + } + } +} + +void CGE2Engine::optionTouch(int opt, uint16 mask) { + warning("STUB: CGE2Engine::optionTouch()"); +} + +void CGE2Engine::offUse() { + warning("STUB: CGE2Engine::offUse()"); +} + + } // End of namespace CGE2 |