aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/cge2/snail.cpp26
-rw-r--r--engines/cge2/snail.h4
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