mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
CGE2: Start implementation of CommandHandler.
Implement constructor, destructor, addCommand() and add clear() ant _count.
This commit is contained in:
parent
02817a7bd5
commit
4dcfe4d785
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user