diff options
author | uruk | 2014-05-23 12:56:48 +0200 |
---|---|---|
committer | uruk | 2014-05-23 12:56:48 +0200 |
commit | 4dcfe4d7853cc59b0c93f43115dc13d17470386f (patch) | |
tree | f288433bee1c64d2917fe575fa4b6c3614707309 | |
parent | 02817a7bd5b5ade5afb51f2ea545238d284b2fd8 (diff) | |
download | scummvm-rg350-4dcfe4d7853cc59b0c93f43115dc13d17470386f.tar.gz scummvm-rg350-4dcfe4d7853cc59b0c93f43115dc13d17470386f.tar.bz2 scummvm-rg350-4dcfe4d7853cc59b0c93f43115dc13d17470386f.zip |
CGE2: Start implementation of CommandHandler.
Implement constructor, destructor, addCommand() and add clear() ant _count.
-rw-r--r-- | engines/cge2/snail.cpp | 26 | ||||
-rw-r--r-- | engines/cge2/snail.h | 4 |
2 files changed, 25 insertions, 5 deletions
diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp index c883606422..5b61d1f7ef 100644 --- a/engines/cge2/snail.cpp +++ b/engines/cge2/snail.cpp @@ -53,12 +53,14 @@ const char *CommandHandler::_commandText[] = { "WALKTO", "REACH", "COVER", "UNCOVER", NULL }; -CommandHandler::CommandHandler(CGE2Engine *vm, bool turbo) : _vm(vm) { - warning("STUB: CommandHandler::CommandHandler()"); +CommandHandler::CommandHandler(CGE2Engine *vm, bool turbo) + : _turbo(turbo), _textDelay(false), _timerExpiry(0), _talkEnable(true), + _head(0), _tail(0), _commandList((Command *)malloc(sizeof(Command)* 256)), + _count(1), _vm(vm) { } CommandHandler::~CommandHandler() { - warning("STUB: CommandHandler::~CommandHandler()"); + free(_commandList); } void CommandHandler::runCommand() { @@ -66,7 +68,17 @@ void CommandHandler::runCommand() { } void CommandHandler::addCommand(CommandType com, int ref, int val, void *ptr) { - warning("STUB: CommandHandler::addCommand()"); + if (ref == 2) + ref = 142 - _vm->_sex; + Command *headCmd = &_commandList[_head++]; + headCmd->_commandType = com; + headCmd->_ref = ref; + headCmd->_val = val; + headCmd->_spritePtr = ptr; + headCmd->_cbType = kNullCB; + if (headCmd->_commandType == kCmdClear) { + clear(); + } } void CommandHandler::addCallback(CommandType com, int ref, int val, CallbackType cbType) { @@ -86,6 +98,12 @@ void CommandHandler::reset() { warning("STUB: CommandHandler::reset()"); } +void CommandHandler::clear() { + _tail = _head; + _vm->killText(); + _timerExpiry = 0; +} + int CommandHandler::com(const char *com) { int i = _vm->takeEnum(_commandText, com); return (i < 0) ? i : i + kCmdCom0 + 1; diff --git a/engines/cge2/snail.h b/engines/cge2/snail.h index a2f4bec028..889b16cd2d 100644 --- a/engines/cge2/snail.h +++ b/engines/cge2/snail.h @@ -131,6 +131,7 @@ public: void insertCommand(CommandType com, int ref, int val, void *ptr); bool idle(); void reset(); + void clear(); int com(const char *com); private: CGE2Engine *_vm; @@ -139,7 +140,8 @@ private: uint8 _tail; bool _busy; bool _textDelay; - uint32 _timerExpiry; + uint32 _timerExpiry; // "pause" in the original. + int _count; }; } // End of namespace CGE2 |