void Scripts::cmdCheckTimer() { int idx = _data->readUint16LE(); _vm->_canSaveLoad = true; _vm->_events->pollEvents(); _vm->_canSaveLoad = false; // Since the ScummVM debugger can be launched from the above point, we need // to check whether the script needs to be ended here, since some commands, // like the scene command, can change the current script if (_endFlag) return; if ((idx == 9) && _vm->_events->isKeyPending()) { _vm->_events->zeroKeys(); _vm->_timers[9]._timer = 0; _vm->_timers[9]._flag = 0; } int val = _data->readUint16LE() & 0xFF; if (_vm->_timers[idx]._flag == val) cmdGoto(); else _data->skip(2); }
void Scripts::cmdCheckAbout() { int idx = _data->readSint16LE(); int val = _data->readSint16LE(); if (_vm->_ask[idx] == val) cmdGoto(); else _data->skip(2); }
void Scripts::cmdVideoEnded() { _vm->_events->pollEventsAndWait(); if (_vm->_video->_videoEnd) { cmdGoto(); } else { _data->skip(2); } }
void Scripts::cmdCheckAnim() { int id = _data->readUint16LE(); Animation *anim = _vm->_animation->findAnimation(id); if (anim->_currentLoopCount == -1) cmdGoto(); else _data->skip(2); }
void Scripts::cmdCheckInventory() { int itemId = _data->readUint16LE(); int itemVal = _data->readUint16LE(); if ((*_vm->_inventory)[itemId] == itemVal) cmdGoto(); else _data->skip(2); }
void Scripts::cmdCheckTravel() { int idx = _data->readSint16LE(); int val = _data->readUint16LE(); if (_vm->_travel[idx] == val) cmdGoto(); else _data->skip(2); }
void Scripts::cmdCheckFrame() { int id = _data->readUint16LE(); Animation *anim = _vm->_animation->findAnimation(id); int frame = _data->readUint16LE(); if (anim->_frameNumber == frame) cmdGoto(); else _data->skip(2); }
void Scripts::cmdCheckFlag() { int flagNum = _data->readUint16LE(); int flagVal = _data->readUint16LE(); assert(flagNum < 256); if (_vm->_flags[flagNum] == flagVal) cmdGoto(); else _data->skip(2); }
void Scripts::cmdCheckLoc() { int minX = _data->readUint16LE(); int minY = _data->readUint16LE(); int maxX = _data->readUint16LE(); int maxY = _data->readUint16LE(); int curX = _vm->_player->_rawPlayer.x + _vm->_player->_playerOffset.x; int curY = _vm->_player->_rawPlayer.y; if ((curX >= minX) && (curX <= maxX) && (curY >= minY) && (curY <= maxY)) cmdGoto(); else _data->skip(2); }
/*! * Returns a pair with status bits. * * The first boolean represents valid input. * If the first boolean is true, the input is valid, otherwise invalid. * The second boolean is true if the command is the quit-command. */ std::pair<bool, bool> Asker::ProcessCommand(std::string command, Specification::Iterator & it) { bool cmdQuit = false; bool validCommand = true; // Remove leading ':' charachter command.erase(command.begin(), command.begin() + 1); // Get Arguments std::vector<std::string>* arguments = Command::InitArguments(command); Helpers::toLower((*arguments)[0]); if (arguments->size() == 1 || arguments->size() == 2) { if (arguments->at(0) == "next") { validCommand = cmdNext(arguments, it); } else if (arguments->at(0) == "back") { validCommand = cmdBack(arguments, it); } else if (arguments->at(0) == "goto" && arguments->size() == 2) { validCommand = cmdGoto(arguments, it); } else if (arguments->at(0) == "list" && arguments->size() == 1) { cmdList(); validCommand = true; } else if (arguments->at(0) == "quit" && arguments->size() == 1) { cmdQuit = true; } else { validCommand = false; } } else { validCommand = false; } // Finish delete arguments;
void Scripts::cmdCheckVFrame() { if (_vm->_video->_videoFrame == _data->readSint16LE()) cmdGoto(); else _data->skip(2); }
void Scripts::cmdJumpGoto() { if (_vm->_room->_selectCommand == 5) cmdGoto(); else _data->skip(2); }