diff options
author | Strangerke | 2011-07-13 00:28:17 +0200 |
---|---|---|
committer | Strangerke | 2011-07-13 00:29:10 +0200 |
commit | 5148f80fa5077e2bdffba44dabac793c9cbe4666 (patch) | |
tree | 9a21165642aed76c51fd56f61da8e0b0648e7dd4 /engines/cge/snail.cpp | |
parent | 4d96ec70340b5f3dbf875ed3a3f6832faffd796c (diff) | |
download | scummvm-rg350-5148f80fa5077e2bdffba44dabac793c9cbe4666.tar.gz scummvm-rg350-5148f80fa5077e2bdffba44dabac793c9cbe4666.tar.bz2 scummvm-rg350-5148f80fa5077e2bdffba44dabac793c9cbe4666.zip |
CGE: add a new SNPOST to fix the function pointer issue
Diffstat (limited to 'engines/cge/snail.cpp')
-rw-r--r-- | engines/cge/snail.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 2fe2d22d5b..23a182cbd5 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -411,6 +411,21 @@ void Snail::addCom(SNCOM com, int ref, int val, void *ptr) { snc->_ref = ref; snc->_val = val; snc->_ptr = ptr; + snc->_cbType = NULLCB; + if (com == SNCLEAR) { + _tail = _head; + killText(); + _timerExpiry = 0; + } +} + +void Snail::addCom2(SNCOM com, int ref, int val, CALLBACK cbType) { + Com *snc = &_snList[_head++]; + snc->_com = com; + snc->_ref = ref; + snc->_val = val; + snc->_ptr = NULL; + snc->_cbType = cbType; if (com == SNCLEAR) { _tail = _head; killText(); @@ -913,8 +928,7 @@ void Snail::runCom() { } break; case SNCAVE : - // SwitchCave(snc->_val); - warning("Problematic call of SwitchCave in SNAIL::runCom"); + _vm->switchCave(snc->_val); break; case SNKILL : _vm->snKill(sprel); @@ -1042,9 +1056,26 @@ void Snail::runCom() { count = snc->_val; break; case SNEXEC : - // TODO: Handle correctly the execution of function pointer coming from Message send SNPOST - // ((void(*)(int)) (snc->_ptr))(snc->_val); - warning("STUB: SNEXEC code"); + switch (snc->_cbType) { + case QGAME: + _vm->qGame(); + break; + case MINISTEP: + _vm->miniStep(snc->_val); + break; + case XCAVE: + _vm->xCave(); + break; + case SELECTSOUND: + _vm->selectSound(); + break; + case SNSELECT: + _vm->snSelect(); + break; + case SNDSETVOLUME: + sndSetVolume(); + break; + } break; case SNSTEP : sprel->step(); |