From 186d90e5b58c09e04f570b51f97a7bd3315dcbde Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 17 Jun 2014 15:37:55 +0200 Subject: CGE2: Implement switching between scenes. Minor modification in Spare again to do so. --- engines/cge2/snail.cpp | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'engines/cge2/snail.cpp') diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp index 068ccf86d5..d799f28cc1 100644 --- a/engines/cge2/snail.cpp +++ b/engines/cge2/snail.cpp @@ -301,7 +301,20 @@ void CommandHandler::runCommand() { _vm->snDim(spr, tailCmd._val); break; case kCmdExec: - warning("Unhandled command - kCmdExec"); + switch (tailCmd._cbType) { + case kQGame: + _vm->qGame(); + break; + case kXScene: + _vm->xScene(); + break; + case kSoundSetVolume: + _vm->sndSetVolume(); + break; + default: + error("Unknown Callback Type in SNEXEC"); + break; + } break; case kCmdStep: spr->step(); @@ -638,6 +651,20 @@ Sprite *CGE2Engine::expandSprite(Sprite *spr) { return spr; } +void CGE2Engine::qGame() { + warning("STUB: CGE2Engine::qGame()"); + _endGame = true; +} + +void CGE2Engine::xScene() { + sceneDown(); + sceneUp(_req); +} + +void CGE2Engine::sndSetVolume() { + warning("STUB: CGE2Engine::sndSetVolume()"); +} + void CommandHandler::addCommand(CommandType com, int ref, int val, void *ptr) { if (ref == 2) ref = 142 - _vm->_sex; @@ -653,7 +680,17 @@ void CommandHandler::addCommand(CommandType com, int ref, int val, void *ptr) { } void CommandHandler::addCallback(CommandType com, int ref, int val, CallbackType cbType) { - warning("STUB: CommandHandler::addCallback()"); + Command *headCmd = &_commandList[_head++]; + headCmd->_commandType = com; + headCmd->_ref = ref; + headCmd->_val = val; + headCmd->_spritePtr = NULL; + headCmd->_cbType = cbType; + if (headCmd->_commandType == kCmdClear) { + _tail = _head; + _vm->killText(); + _timerExpiry = 0; + } } void CommandHandler::insertCommand(CommandType com, int ref, int val, void *ptr) { -- cgit v1.2.3