mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 19:54:03 +00:00
ULTIMA8: Handle movement actions without debugger console
Previously all keybind actions were handled with debugger console commands. This required the existence console commands that are unlikely to have use outside the keybinding action. Additionally, every input iterates over a lookup table and parses command strings.
This commit is contained in:
parent
bdd16491f7
commit
0380bf3d44
@ -48,15 +48,15 @@ static const KeybindingRecord COMMON_KEYS[] = {
|
||||
{ ACTION_LOAD, "LOAD", "Load Game", "GUIApp::loadGame", nullptr, "F7", nullptr },
|
||||
{ ACTION_COMBAT, "COMBAT", "Combat", "MainActor::toggleCombat", nullptr, "c", "JOY_X" },
|
||||
{ ACTION_MENU, "MENU", "Game Menu", "MenuGump::showMenu", nullptr, "ESCAPE", "JOY_Y" },
|
||||
{ ACTION_TURN_LEFT, "TURN_LEFT", "Turn Left", "AvatarMoverProcess::startTurnLeft", "AvatarMoverProcess::stopTurnLeft", "LEFT", "KP4" },
|
||||
{ ACTION_TURN_RIGHT, "TURN_RIGHT", "Turn Right", "AvatarMoverProcess::startTurnRight", "AvatarMoverProcess::stopTurnRight", "RIGHT", "KP6" },
|
||||
{ ACTION_MOVE_FORWARD, "MOVE_FORWARD", "Move Forward", "AvatarMoverProcess::startMoveForward", "AvatarMoverProcess::stopMoveForward", "UP", "KP8" },
|
||||
{ ACTION_MOVE_BACK, "MOVE_BACK", "Move Back", "AvatarMoverProcess::startMoveBack", "AvatarMoverProcess::stopMoveBack", "DOWN", "KP2" },
|
||||
{ ACTION_MOVE_UP, "MOVE_UP", "Move Up", "AvatarMoverProcess::startMoveUp", "AvatarMoverProcess::stopMoveUp", nullptr, "JOY_UP" },
|
||||
{ ACTION_MOVE_DOWN, "MOVE_DOWN", "Move Down", "AvatarMoverProcess::startMoveDown", "AvatarMoverProcess::stopMoveDown", nullptr, "JOY_DOWN" },
|
||||
{ ACTION_MOVE_LEFT, "MOVE_LEFT", "Move Left", "AvatarMoverProcess::startMoveLeft", "AvatarMoverProcess::stopMoveLeft", nullptr, "JOY_LEFT" },
|
||||
{ ACTION_MOVE_RIGHT, "MOVE_RIGHT", "Move Right", "AvatarMoverProcess::startMoveRight", "AvatarMoverProcess::stopMoveRight", nullptr, "JOY_RIGHT" },
|
||||
{ ACTION_MOVE_RUN, "MOVE_RUN", "Run", "AvatarMoverProcess::startMoveRun", "AvatarMoverProcess::stopMoveRun", "LSHIFT", "JOY_RIGHT_TRIGGER" },
|
||||
{ ACTION_TURN_LEFT, "TURN_LEFT", "Turn Left", nullptr, nullptr, "LEFT", "KP4" },
|
||||
{ ACTION_TURN_RIGHT, "TURN_RIGHT", "Turn Right", nullptr, nullptr, "RIGHT", "KP6" },
|
||||
{ ACTION_MOVE_FORWARD, "MOVE_FORWARD", "Move Forward", nullptr, nullptr, "UP", "KP8" },
|
||||
{ ACTION_MOVE_BACK, "MOVE_BACK", "Move Back", nullptr, nullptr, "DOWN", "KP2" },
|
||||
{ ACTION_MOVE_UP, "MOVE_UP", "Move Up", nullptr, nullptr, nullptr, "JOY_UP" },
|
||||
{ ACTION_MOVE_DOWN, "MOVE_DOWN", "Move Down", nullptr, nullptr, nullptr, "JOY_DOWN" },
|
||||
{ ACTION_MOVE_LEFT, "MOVE_LEFT", "Move Left", nullptr, nullptr, nullptr, "JOY_LEFT" },
|
||||
{ ACTION_MOVE_RIGHT, "MOVE_RIGHT", "Move Right", nullptr, nullptr, nullptr, "JOY_RIGHT" },
|
||||
{ ACTION_MOVE_RUN, "MOVE_RUN", "Run", nullptr, nullptr, "LSHIFT", "JOY_RIGHT_TRIGGER" },
|
||||
{ ACTION_HIGHLIGHT_ITEMS, "HIGHLIGHT_ITEMS", "Highlight Items", "GameMapGump::startHighlightItems", "GameMapGump::stopHighlightItems", "h", nullptr },
|
||||
|
||||
{ ACTION_NONE, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
|
||||
@ -70,8 +70,8 @@ static const KeybindingRecord U8_KEYS[] = {
|
||||
{ ACTION_RECALL, "RECALL", "Use Recall", "MainActor::useRecall", nullptr, "r", nullptr },
|
||||
{ ACTION_INVENTORY, "INVENTORY", "Inventory", "MainActor::useInventory", nullptr, "z", "JOY_LEFT_STICK" },
|
||||
{ ACTION_CLOSE_GUMPS, "CLOSE_GUMPS", "Close Gumps", "GUIApp::closeItemGumps", nullptr, "BACKSPACE", nullptr },
|
||||
{ ACTION_JUMP, "JUMP", "Jump (fake both-button-click)", "AvatarMoverProcess::startJump", "AvatarMoverProcess::stopJump", "SPACE", nullptr },
|
||||
{ ACTION_MOVE_STEP, "MOVE_STEP", "Step", "AvatarMoverProcess::startMoveStep", "AvatarMoverProcess::stopMoveStep", "LCTRL", "JOY_LEFT_TRIGGER" },
|
||||
{ ACTION_JUMP, "JUMP", "Jump (fake both-button-click)", nullptr, nullptr, "SPACE", nullptr },
|
||||
{ ACTION_MOVE_STEP, "MOVE_STEP", "Step", nullptr, nullptr, "LCTRL", "JOY_LEFT_TRIGGER" },
|
||||
|
||||
{ ACTION_NONE, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
|
||||
};
|
||||
@ -88,18 +88,18 @@ static const KeybindingRecord CRUSADER_KEYS[] = {
|
||||
{ ACTION_SELECT_ITEMS, "SELECT_ITEM", "Select Item", "ItemSelectionProcess::startSelection", nullptr, "s", "KP_PLUS" },
|
||||
{ ACTION_USE_SELECTION, "USE_SELECTION", "Use Selection", "ItemSelectionProcess::useSelectedItem", nullptr, "RETURN", "KP_ENTER" },
|
||||
{ ACTION_GRAB_ITEMS, "GRAB_ITEM", "Grab Items", "ItemSelectionProcess::grabItems", nullptr, "g", nullptr },
|
||||
{ ACTION_ATTACK, "ATTACK", "Attack", "AvatarMoverProcess::startAttack", "AvatarMoverProcess::stopAttack", "SPACE", "KP0" },
|
||||
{ ACTION_ATTACK, "ATTACK", "Attack", nullptr, nullptr, "SPACE", "KP0" },
|
||||
{ ACTION_CAMERA_AVATAR, "CAMERA_AVATAR", "Focus Camera on Silencer", "CameraProcess::moveToAvatar", nullptr, "z", nullptr },
|
||||
{ ACTION_JUMP, "JUMP", "Jump / Roll / Crouch", "AvatarMoverProcess::startJump", "AvatarMoverProcess::stopJump", "LCTRL", nullptr },
|
||||
{ ACTION_SHORT_JUMP, "SHORT_JUMP", "Short Jump", "AvatarMoverProcess::shortJump", nullptr, "TAB", "j" },
|
||||
{ ACTION_STEP_LEFT, "STEP_LEFT", "Sidestep Left", "AvatarMoverProcess::stepLeft", nullptr, "DELETE", "KP7" },
|
||||
{ ACTION_STEP_RIGHT, "STEP_RIGHT", "Sidestep Rgiht", "AvatarMoverProcess::stepRight", nullptr, "PAGEDOWN", "KP9" },
|
||||
{ ACTION_STEP_FORWARD, "STEP_FORWARD", "Step Forward", "AvatarMoverProcess::stepForward", nullptr, "HOME", "KP_DIVIDE" },
|
||||
{ ACTION_STEP_BACK, "STEP_BACK", "Step Back", "AvatarMoverProcess::stepBack", nullptr, "END", "KP2" },
|
||||
{ ACTION_ROLL_LEFT, "ROLL_LEFT", "Roll Left", "AvatarMoverProcess::rollLeft", nullptr, "INSERT", "KP1" },
|
||||
{ ACTION_ROLL_RIGHT, "ROLL_RIGHT", "Roll Right", "AvatarMoverProcess::rollRight", nullptr, "PAGEUP", "KP3" },
|
||||
{ ACTION_TOGGLE_CROUCH, "TOGGLE_CROUCH", "Toggle Crouch", "AvatarMoverProcess::toggleCrouch", nullptr, "KP5", nullptr },
|
||||
{ ACTION_MOVE_STEP, "MOVE_STEP", "Side Step / Advance / Retreat", "AvatarMoverProcess::startMoveStep", "AvatarMoverProcess::stopMoveStep", "LALT", "JOY_RIGHT_SHOULDER" },
|
||||
{ ACTION_JUMP, "JUMP", "Jump / Roll / Crouch", nullptr, nullptr, "LCTRL", nullptr },
|
||||
{ ACTION_SHORT_JUMP, "SHORT_JUMP", "Short Jump", nullptr, nullptr, "TAB", "j" },
|
||||
{ ACTION_STEP_LEFT, "STEP_LEFT", "Sidestep Left", nullptr, nullptr, "DELETE", "KP7" },
|
||||
{ ACTION_STEP_RIGHT, "STEP_RIGHT", "Sidestep Rgiht", nullptr, nullptr, "PAGEDOWN", "KP9" },
|
||||
{ ACTION_STEP_FORWARD, "STEP_FORWARD", "Step Forward", nullptr, nullptr, "HOME", "KP_DIVIDE" },
|
||||
{ ACTION_STEP_BACK, "STEP_BACK", "Step Back", nullptr, nullptr, "END", "KP2" },
|
||||
{ ACTION_ROLL_LEFT, "ROLL_LEFT", "Roll Left", nullptr, nullptr, "INSERT", "KP1" },
|
||||
{ ACTION_ROLL_RIGHT, "ROLL_RIGHT", "Roll Right", nullptr, nullptr, "PAGEUP", "KP3" },
|
||||
{ ACTION_TOGGLE_CROUCH, "TOGGLE_CROUCH", "Toggle Crouch", nullptr, nullptr, "KP5", nullptr },
|
||||
{ ACTION_MOVE_STEP, "MOVE_STEP", "Side Step / Advance / Retreat", nullptr, nullptr, "LALT", "JOY_RIGHT_SHOULDER" },
|
||||
{ ACTION_NONE, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -79,42 +79,6 @@ Debugger::Debugger() : GUI::Debugger() {
|
||||
registerCmd("Ultima8Engine::toggleShowTouchingItems", WRAP_METHOD(Debugger, cmdToggleShowTouchingItems));
|
||||
registerCmd("Ultima8Engine::closeItemGumps", WRAP_METHOD(Debugger, cmdCloseItemGumps));
|
||||
|
||||
registerCmd("AvatarMoverProcess::startJump", WRAP_METHOD(Debugger, cmdStartJump));
|
||||
registerCmd("AvatarMoverProcess::stopJump", WRAP_METHOD(Debugger, cmdStopJump));
|
||||
registerCmd("AvatarMoverProcess::startTurnLeft", WRAP_METHOD(Debugger, cmdStartTurnLeft));
|
||||
registerCmd("AvatarMoverProcess::startTurnRight", WRAP_METHOD(Debugger, cmdStartTurnRight));
|
||||
registerCmd("AvatarMoverProcess::startMoveForward", WRAP_METHOD(Debugger, cmdStartMoveForward));
|
||||
registerCmd("AvatarMoverProcess::startMoveBack", WRAP_METHOD(Debugger, cmdStartMoveBack));
|
||||
registerCmd("AvatarMoverProcess::stopTurnLeft", WRAP_METHOD(Debugger, cmdStopTurnLeft));
|
||||
registerCmd("AvatarMoverProcess::stopTurnRight", WRAP_METHOD(Debugger, cmdStopTurnRight));
|
||||
registerCmd("AvatarMoverProcess::stopMoveForward", WRAP_METHOD(Debugger, cmdStopMoveForward));
|
||||
registerCmd("AvatarMoverProcess::stopMoveBack", WRAP_METHOD(Debugger, cmdStopMoveBack));
|
||||
|
||||
registerCmd("AvatarMoverProcess::startMoveLeft", WRAP_METHOD(Debugger, cmdStartMoveLeft));
|
||||
registerCmd("AvatarMoverProcess::startMoveRight", WRAP_METHOD(Debugger, cmdStartMoveRight));
|
||||
registerCmd("AvatarMoverProcess::startMoveUp", WRAP_METHOD(Debugger, cmdStartMoveUp));
|
||||
registerCmd("AvatarMoverProcess::startMoveDown", WRAP_METHOD(Debugger, cmdStartMoveDown));
|
||||
registerCmd("AvatarMoverProcess::stopMoveLeft", WRAP_METHOD(Debugger, cmdStopMoveLeft));
|
||||
registerCmd("AvatarMoverProcess::stopMoveRight", WRAP_METHOD(Debugger, cmdStopMoveRight));
|
||||
registerCmd("AvatarMoverProcess::stopMoveUp", WRAP_METHOD(Debugger, cmdStopMoveUp));
|
||||
registerCmd("AvatarMoverProcess::stopMoveDown", WRAP_METHOD(Debugger, cmdStopMoveDown));
|
||||
|
||||
registerCmd("AvatarMoverProcess::startMoveRun", WRAP_METHOD(Debugger, cmdStartMoveRun));
|
||||
registerCmd("AvatarMoverProcess::stopMoveRun", WRAP_METHOD(Debugger, cmdStopMoveRun));
|
||||
registerCmd("AvatarMoverProcess::startMoveStep", WRAP_METHOD(Debugger, cmdStartMoveStep));
|
||||
registerCmd("AvatarMoverProcess::stopMoveStep", WRAP_METHOD(Debugger, cmdStopMoveStep));
|
||||
registerCmd("AvatarMoverProcess::startAttack", WRAP_METHOD(Debugger, cmdStartAttack));
|
||||
registerCmd("AvatarMoverProcess::stopAttack", WRAP_METHOD(Debugger, cmdStopAttack));
|
||||
|
||||
registerCmd("AvatarMoverProcess::shortJump", WRAP_METHOD(Debugger, cmdShortJump));
|
||||
registerCmd("AvatarMoverProcess::stepLeft", WRAP_METHOD(Debugger, cmdStepLeft));
|
||||
registerCmd("AvatarMoverProcess::stepRight", WRAP_METHOD(Debugger, cmdStepRight));
|
||||
registerCmd("AvatarMoverProcess::stepForward", WRAP_METHOD(Debugger, cmdStepForward));
|
||||
registerCmd("AvatarMoverProcess::stepBack", WRAP_METHOD(Debugger, cmdStepBack));
|
||||
registerCmd("AvatarMoverProcess::rollLeft", WRAP_METHOD(Debugger, cmdRollLeft));
|
||||
registerCmd("AvatarMoverProcess::rollRight", WRAP_METHOD(Debugger, cmdRollRight));
|
||||
registerCmd("AvatarMoverProcess::toggleCrouch", WRAP_METHOD(Debugger, cmdToggleCrouch));
|
||||
|
||||
registerCmd("CameraProcess::moveToAvatar", WRAP_METHOD(Debugger, cmdCameraOnAvatar));
|
||||
|
||||
registerCmd("AudioProcess::listSFX", WRAP_METHOD(Debugger, cmdListSFX));
|
||||
@ -1230,161 +1194,6 @@ bool Debugger::cmdCameraOnAvatar(int argc, const char **argv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool _avatarMoveKey(uint32 flag, const char *debugname) {
|
||||
Ultima8Engine *engine = Ultima8Engine::get_instance();
|
||||
engine->moveKeyEvent();
|
||||
if (engine->isAvatarInStasis()) {
|
||||
debug("Can't %s: avatarInStasis", debugname);
|
||||
return false;
|
||||
}
|
||||
AvatarMoverProcess *proc = engine->getAvatarMoverProcess();
|
||||
|
||||
if (proc) {
|
||||
proc->setMovementFlag(flag);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool _avatarMoveKeyEnd(uint32 flag) {
|
||||
Ultima8Engine *engine = Ultima8Engine::get_instance();
|
||||
engine->moveKeyEvent();
|
||||
|
||||
AvatarMoverProcess *proc = engine->getAvatarMoverProcess();
|
||||
if (proc) {
|
||||
proc->clearMovementFlag(flag);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartAttack(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_ATTACKING, "attack");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopAttack(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_ATTACKING);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartJump(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_JUMP, "jump");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopJump(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_JUMP);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartTurnLeft(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_TURN_LEFT, "turn left");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartTurnRight(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_TURN_RIGHT, "turn right");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartMoveForward(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_FORWARD, "move forward");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartMoveBack(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_BACK, "move back");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartMoveLeft(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_LEFT, "move left");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartMoveRight(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_RIGHT, "move right");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartMoveUp(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_UP, "move up");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartMoveDown(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_DOWN, "move down");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopTurnLeft(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_TURN_LEFT);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopTurnRight(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_TURN_RIGHT);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopMoveForward(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_FORWARD);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopMoveBack(int argc, const char **argv) {
|
||||
// Clear both back and forward as avatar turns then moves forward when not in combat
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_BACK | AvatarMoverProcess::MOVE_FORWARD);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopMoveLeft(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_LEFT);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopMoveRight(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_RIGHT);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopMoveUp(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_UP);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopMoveDown(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_DOWN);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartMoveRun(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_RUN, "run");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopMoveRun(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_RUN);
|
||||
}
|
||||
|
||||
bool Debugger::cmdStartMoveStep(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_STEP, "step");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStopMoveStep(int argc, const char **argv) {
|
||||
return _avatarMoveKeyEnd(AvatarMoverProcess::MOVE_STEP);
|
||||
}
|
||||
|
||||
bool Debugger::cmdShortJump(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_SHORT_JUMP, "short jump");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStepLeft(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_STEP_LEFT, "step left");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStepRight(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_STEP_RIGHT, "step right");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStepForward(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_STEP_FORWARD, "step forward");
|
||||
}
|
||||
|
||||
bool Debugger::cmdStepBack(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_STEP_BACK, "step back");
|
||||
}
|
||||
|
||||
bool Debugger::cmdRollLeft(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_ROLL_LEFT, "roll left");
|
||||
}
|
||||
|
||||
bool Debugger::cmdRollRight(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_ROLL_RIGHT, "roll right");
|
||||
}
|
||||
|
||||
bool Debugger::cmdToggleCrouch(int argc, const char **argv) {
|
||||
return _avatarMoveKey(AvatarMoverProcess::MOVE_TOGGLE_CROUCH, "toggle crouch");
|
||||
}
|
||||
|
||||
bool Debugger::cmdToggleCombat(int argc, const char **argv) {
|
||||
if (Ultima8Engine::get_instance()->isAvatarInStasis()) {
|
||||
debugPrintf("Can't toggle combat: avatarInStasis");
|
||||
|
@ -52,43 +52,6 @@ private:
|
||||
bool cmdToggleShowTouchingItems(int argc, const char **argv);
|
||||
bool cmdCloseItemGumps(int argc, const char **argv);
|
||||
|
||||
// Avatar mover
|
||||
bool cmdStartJump(int argc, const char **argv);
|
||||
bool cmdStopJump(int argc, const char **argv);
|
||||
bool cmdStartTurnLeft(int argc, const char **argv);
|
||||
bool cmdStartTurnRight(int argc, const char **argv);
|
||||
bool cmdStartMoveForward(int argc, const char **argv);
|
||||
bool cmdStartMoveBack(int argc, const char **argv);
|
||||
bool cmdStopTurnLeft(int argc, const char **argv);
|
||||
bool cmdStopTurnRight(int argc, const char **argv);
|
||||
bool cmdStopMoveForward(int argc, const char **argv);
|
||||
bool cmdStopMoveBack(int argc, const char **argv);
|
||||
bool cmdStartMoveUp(int argc, const char **argv);
|
||||
bool cmdStartMoveDown(int argc, const char **argv);
|
||||
bool cmdStartMoveLeft(int argc, const char **argv);
|
||||
bool cmdStartMoveRight(int argc, const char **argv);
|
||||
bool cmdStopMoveUp(int argc, const char **argv);
|
||||
bool cmdStopMoveDown(int argc, const char **argv);
|
||||
bool cmdStopMoveLeft(int argc, const char **argv);
|
||||
bool cmdStopMoveRight(int argc, const char **argv);
|
||||
|
||||
bool cmdStartMoveRun(int argc, const char **argv);
|
||||
bool cmdStopMoveRun(int argc, const char **argv);
|
||||
bool cmdStartMoveStep(int argc, const char **argv);
|
||||
bool cmdStopMoveStep(int argc, const char **argv);
|
||||
bool cmdStartAttack(int argc, const char **argv);
|
||||
bool cmdStopAttack(int argc, const char **argv);
|
||||
|
||||
// One-shot Avatar mover commands
|
||||
bool cmdShortJump(int argc, const char **argv);
|
||||
bool cmdStepLeft(int argc, const char **argv);
|
||||
bool cmdStepRight(int argc, const char **argv);
|
||||
bool cmdStepForward(int argc, const char **argv);
|
||||
bool cmdStepBack(int argc, const char **argv);
|
||||
bool cmdRollLeft(int argc, const char **argv);
|
||||
bool cmdRollRight(int argc, const char **argv);
|
||||
bool cmdToggleCrouch(int argc, const char **argv);
|
||||
|
||||
bool cmdCameraOnAvatar(int argc, const char **argv);
|
||||
|
||||
// Audio Process
|
||||
|
@ -872,12 +872,24 @@ void Ultima8Engine::handleDelayedEvents() {
|
||||
}
|
||||
|
||||
void Ultima8Engine::handleActionDown(KeybindingAction action) {
|
||||
if (!isAvatarInStasis()) {
|
||||
if (_avatarMoverProcess && _avatarMoverProcess->onActionDown(action)) {
|
||||
moveKeyEvent();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Common::String methodName = MetaEngine::getMethod(action, true);
|
||||
if (!methodName.empty())
|
||||
g_debugger->executeCommand(methodName);
|
||||
}
|
||||
|
||||
void Ultima8Engine::handleActionUp(KeybindingAction action) {
|
||||
if (_avatarMoverProcess && _avatarMoverProcess->onActionUp(action)) {
|
||||
moveKeyEvent();
|
||||
return;
|
||||
}
|
||||
|
||||
Common::String methodName = MetaEngine::getMethod(action, false);
|
||||
if (!methodName.empty())
|
||||
g_debugger->executeCommand(methodName);
|
||||
|
@ -222,6 +222,144 @@ void AvatarMoverProcess::onMouseUp(int button) {
|
||||
_mouseButton[bid].clearState(MBS_DOWN);
|
||||
}
|
||||
|
||||
bool AvatarMoverProcess::onActionDown(KeybindingAction action) {
|
||||
bool handled = true;
|
||||
switch (action) {
|
||||
case ACTION_JUMP:
|
||||
setMovementFlag(MOVE_JUMP);
|
||||
break;
|
||||
case ACTION_SHORT_JUMP:
|
||||
setMovementFlag(MOVE_SHORT_JUMP);
|
||||
break;
|
||||
case ACTION_TURN_LEFT:
|
||||
setMovementFlag(MOVE_TURN_LEFT);
|
||||
break;
|
||||
case ACTION_TURN_RIGHT:
|
||||
setMovementFlag(MOVE_TURN_RIGHT);
|
||||
break;
|
||||
case ACTION_MOVE_FORWARD:
|
||||
setMovementFlag(MOVE_FORWARD);
|
||||
break;
|
||||
case ACTION_MOVE_BACK:
|
||||
setMovementFlag(MOVE_BACK);
|
||||
break;
|
||||
case ACTION_MOVE_UP:
|
||||
setMovementFlag(MOVE_UP);
|
||||
break;
|
||||
case ACTION_MOVE_DOWN:
|
||||
setMovementFlag(MOVE_DOWN);
|
||||
break;
|
||||
case ACTION_MOVE_LEFT:
|
||||
setMovementFlag(MOVE_LEFT);
|
||||
break;
|
||||
case ACTION_MOVE_RIGHT:
|
||||
setMovementFlag(MOVE_RIGHT);
|
||||
break;
|
||||
case ACTION_MOVE_RUN:
|
||||
setMovementFlag(MOVE_RUN);
|
||||
break;
|
||||
case ACTION_MOVE_STEP:
|
||||
setMovementFlag(MOVE_STEP);
|
||||
break;
|
||||
case ACTION_ATTACK:
|
||||
setMovementFlag(MOVE_ATTACKING);
|
||||
break;
|
||||
case ACTION_STEP_LEFT:
|
||||
setMovementFlag(MOVE_STEP_LEFT);
|
||||
break;
|
||||
case ACTION_STEP_RIGHT:
|
||||
setMovementFlag(MOVE_STEP_RIGHT);
|
||||
break;
|
||||
case ACTION_STEP_FORWARD:
|
||||
setMovementFlag(MOVE_STEP_FORWARD);
|
||||
break;
|
||||
case ACTION_STEP_BACK:
|
||||
setMovementFlag(MOVE_STEP_BACK);
|
||||
break;
|
||||
case ACTION_ROLL_LEFT:
|
||||
setMovementFlag(MOVE_ROLL_LEFT);
|
||||
break;
|
||||
case ACTION_ROLL_RIGHT:
|
||||
setMovementFlag(MOVE_ROLL_RIGHT);
|
||||
break;
|
||||
case ACTION_TOGGLE_CROUCH:
|
||||
setMovementFlag(MOVE_TOGGLE_CROUCH);
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
bool AvatarMoverProcess::onActionUp(KeybindingAction action) {
|
||||
bool handled = true;
|
||||
switch (action) {
|
||||
case ACTION_JUMP:
|
||||
clearMovementFlag(MOVE_JUMP);
|
||||
break;
|
||||
case ACTION_SHORT_JUMP:
|
||||
// Cleared when handled
|
||||
break;
|
||||
case ACTION_TURN_LEFT:
|
||||
clearMovementFlag(MOVE_TURN_LEFT);
|
||||
break;
|
||||
case ACTION_TURN_RIGHT:
|
||||
clearMovementFlag(MOVE_TURN_RIGHT);
|
||||
break;
|
||||
case ACTION_MOVE_FORWARD:
|
||||
clearMovementFlag(MOVE_FORWARD);
|
||||
break;
|
||||
case ACTION_MOVE_BACK:
|
||||
// Clear both back and forward as avatar turns then moves forward when not in combat
|
||||
clearMovementFlag(MOVE_BACK | MOVE_FORWARD);
|
||||
break;
|
||||
case ACTION_MOVE_UP:
|
||||
clearMovementFlag(MOVE_UP);
|
||||
break;
|
||||
case ACTION_MOVE_DOWN:
|
||||
clearMovementFlag(MOVE_DOWN);
|
||||
break;
|
||||
case ACTION_MOVE_LEFT:
|
||||
clearMovementFlag(MOVE_LEFT);
|
||||
break;
|
||||
case ACTION_MOVE_RIGHT:
|
||||
clearMovementFlag(MOVE_RIGHT);
|
||||
break;
|
||||
case ACTION_MOVE_RUN:
|
||||
clearMovementFlag(MOVE_RUN);
|
||||
break;
|
||||
case ACTION_MOVE_STEP:
|
||||
clearMovementFlag(MOVE_STEP);
|
||||
break;
|
||||
case ACTION_ATTACK:
|
||||
clearMovementFlag(MOVE_ATTACKING);
|
||||
break;
|
||||
case ACTION_STEP_LEFT:
|
||||
// Cleared when handled
|
||||
break;
|
||||
case ACTION_STEP_RIGHT:
|
||||
// Cleared when handled
|
||||
break;
|
||||
case ACTION_STEP_FORWARD:
|
||||
// Cleared when handled
|
||||
break;
|
||||
case ACTION_STEP_BACK:
|
||||
// Cleared when handled
|
||||
break;
|
||||
case ACTION_ROLL_LEFT:
|
||||
// Cleared when handled
|
||||
break;
|
||||
case ACTION_ROLL_RIGHT:
|
||||
// Cleared when handled
|
||||
break;
|
||||
case ACTION_TOGGLE_CROUCH:
|
||||
// Cleared when handled
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
void AvatarMoverProcess::saveData(Common::WriteStream *ws) {
|
||||
Process::saveData(ws);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#ifndef WORLD_ACTORS_AVATARMOVERPROCESS_H
|
||||
#define WORLD_ACTORS_AVATARMOVERPROCESS_H
|
||||
|
||||
#include "ultima/ultima8/metaengine.h"
|
||||
#include "ultima/ultima8/kernel/process.h"
|
||||
#include "ultima/ultima8/kernel/mouse.h"
|
||||
#include "ultima/ultima8/world/actors/animation.h"
|
||||
@ -62,6 +63,10 @@ public:
|
||||
void onMouseDown(int button, int32 mx, int32 my);
|
||||
void onMouseUp(int button);
|
||||
|
||||
// Return true if handled, false if not.
|
||||
bool onActionDown(KeybindingAction action);
|
||||
bool onActionUp(KeybindingAction action);
|
||||
|
||||
enum MovementFlags {
|
||||
MOVE_MOUSE_DIRECTION = 0x001,
|
||||
MOVE_RUN = 0x0002,
|
||||
|
Loading…
Reference in New Issue
Block a user