diff --git a/engines/ultima/ultima4/core/debugger.cpp b/engines/ultima/ultima4/core/debugger.cpp index 935e0327be2..11302c9444b 100644 --- a/engines/ultima/ultima4/core/debugger.cpp +++ b/engines/ultima/ultima4/core/debugger.cpp @@ -890,6 +890,38 @@ bool Debugger::cmdSearch(int argc, const char **argv) { return isDebuggerActive(); } +bool Debugger::cmdSpeed(int argc, const char **argv) { + Common::String action = argv[1]; + int old_cycles = settings._gameCyclesPerSecond; + + if (action == "up") { + if (++settings._gameCyclesPerSecond > MAX_CYCLES_PER_SECOND) + settings._gameCyclesPerSecond = MAX_CYCLES_PER_SECOND; + } else if (action == "down") { + if (--settings._gameCyclesPerSecond == 0) + settings._gameCyclesPerSecond = 1; + } else if (action == "normal") { + settings._gameCyclesPerSecond = DEFAULT_CYCLES_PER_SECOND; + } + + if (old_cycles != settings._gameCyclesPerSecond) { + settings._eventTimerGranularity = (1000 / settings._gameCyclesPerSecond); + eventHandler->getTimer()->reset(settings._eventTimerGranularity); + + if (settings._gameCyclesPerSecond == DEFAULT_CYCLES_PER_SECOND) + print("Speed: Normal"); + else if (action == "up") + print("Speed Up (%d)", settings._gameCyclesPerSecond); + else + print("Speed Down (%d)", settings._gameCyclesPerSecond); + } else if (settings._gameCyclesPerSecond == DEFAULT_CYCLES_PER_SECOND) { + print("Speed: Normal"); + } + + dontEndTurn(); + return isDebuggerActive(); +} + bool Debugger::cmdStats(int argc, const char **argv) { int player = -1; if (argc == 2) diff --git a/engines/ultima/ultima4/core/debugger.h b/engines/ultima/ultima4/core/debugger.h index ae71406f06c..1906c477a87 100644 --- a/engines/ultima/ultima4/core/debugger.h +++ b/engines/ultima/ultima4/core/debugger.h @@ -195,6 +195,11 @@ private: */ bool cmdSearch(int argc, const char **argv); + /** + * Speed up, down, or normal + */ + bool cmdSpeed(int argc, const char **argv); + /** * Show character stats */ diff --git a/engines/ultima/ultima4/game/game.cpp b/engines/ultima/ultima4/game/game.cpp index 005eae0146a..f1da64d623c 100644 --- a/engines/ultima/ultima4/game/game.cpp +++ b/engines/ultima/ultima4/game/game.cpp @@ -602,63 +602,6 @@ bool GameController::keyPressed(int key) { screenMessage("%cNot here!%c\n", FG_GREY, FG_WHITE); else switch (key) { - case ' ': - screenMessage("Pass\n"); - break; - - case '+': - case '-': - case U4_KEYPAD_ENTER: { - int old_cycles = settings._gameCyclesPerSecond; - if (key == '+' && ++settings._gameCyclesPerSecond > MAX_CYCLES_PER_SECOND) - settings._gameCyclesPerSecond = MAX_CYCLES_PER_SECOND; - else if (key == '-' && --settings._gameCyclesPerSecond == 0) - settings._gameCyclesPerSecond = 1; - else if (key == U4_KEYPAD_ENTER) - settings._gameCyclesPerSecond = DEFAULT_CYCLES_PER_SECOND; - - if (old_cycles != settings._gameCyclesPerSecond) { - settings._eventTimerGranularity = (1000 / settings._gameCyclesPerSecond); - eventHandler->getTimer()->reset(settings._eventTimerGranularity); - - if (settings._gameCyclesPerSecond == DEFAULT_CYCLES_PER_SECOND) - screenMessage("Speed: Normal\n"); - else if (key == '+') - screenMessage("Speed Up (%d)\n", settings._gameCyclesPerSecond); - else screenMessage("Speed Down (%d)\n", settings._gameCyclesPerSecond); - } else if (settings._gameCyclesPerSecond == DEFAULT_CYCLES_PER_SECOND) - screenMessage("Speed: Normal\n"); - } - - endTurn = false; - break; - - /* handle music volume adjustments */ - case ',': - // decrease the volume if possible - screenMessage("Music: %d%s\n", g_music->decreaseMusicVolume(), "%"); - endTurn = false; - break; - case '.': - // increase the volume if possible - screenMessage("Music: %d%s\n", g_music->increaseMusicVolume(), "%"); - endTurn = false; - break; - - /* handle sound volume adjustments */ - case '<': - // decrease the volume if possible - screenMessage("Sound: %d%s\n", g_music->decreaseSoundVolume(), "%"); - soundPlay(SOUND_FLEE); - endTurn = false; - break; - case '>': - // increase the volume if possible - screenMessage("Sound: %d%s\n", g_music->increaseSoundVolume(), "%"); - soundPlay(SOUND_FLEE); - endTurn = false; - break; - case 'c' + U4_ALT: if (settings._debug && g_context->_location->_map->isWorldMap()) { /* first teleport to the abyss */ diff --git a/engines/ultima/ultima4/meta_engine.cpp b/engines/ultima/ultima4/meta_engine.cpp index 9c2159ece8d..3f1a10be890 100644 --- a/engines/ultima/ultima4/meta_engine.cpp +++ b/engines/ultima/ultima4/meta_engine.cpp @@ -62,8 +62,11 @@ static const KeybindingRecord KEYS[] = { { KEYBIND_PASS, "PASS", "Pass", "pass", "SPACE", nullptr }, { KEYBIND_PEER, "PEER", "Peer", "peer", "p", nullptr }, { KEYBIND_QUIT_SAVE, "QUIT-SAVE", "Quit and Save", "quitAndSave", "q", nullptr }, - { KEYBIND_READY_WEAPON, "READY-WEAPON", "Ready Weapon", "ready", nullptr }, + { KEYBIND_READY_WEAPON, "READY-WEAPON", "Ready Weapon", "ready", "r", nullptr }, { KEYBIND_SEARCH, "SEARCH", "Search", "search", "s", nullptr }, + { KEYBIND_SPEED_UP, "SPEED-UP", "Speed Up", "speed up", "PLUS", nullptr }, + { KEYBIND_SPEED_DOWN, "SPEED-DOWN", "Speed Down", "speed down", "MINUS", nullptr }, + { KEYBIND_SPEED_NORMAL, "SPEED-NORMAL", "Speed Normal", "speed normal", "KP_ENTER", nullptr }, { KEYBIND_STATS, "STATS", "Stats", "stats", "z", nullptr }, { KEYBIND_TALK, "TALK", "Talk", "talk", "t", nullptr }, { KEYBIND_TOGGLE_MUSIC, "TOGGLE-MUSIC", "Toggle Music", "musicToggle", "v", nullptr }, diff --git a/engines/ultima/ultima4/meta_engine.h b/engines/ultima/ultima4/meta_engine.h index cd56702d318..1d2efe79435 100644 --- a/engines/ultima/ultima4/meta_engine.h +++ b/engines/ultima/ultima4/meta_engine.h @@ -35,9 +35,10 @@ enum KeybindingAction { KEYBIND_GET, KEYBIND_HOLE_UP, KEYBIND_IGNITE, KEYBIND_JIMMY, KEYBIND_LOCATE, KEYBIND_MIX, KEYBIND_NEW_ORDER, KEYBIND_OPEN_DOOR, KEYBIND_PASS, KEYBIND_PEER, - KEYBIND_QUIT_SAVE, KEYBIND_READY_WEAPON, KEYBIND_SEARCH, - KEYBIND_STATS, KEYBIND_TALK, KEYBIND_TOGGLE_MUSIC, - KEYBIND_USE, KEYBIND_WEAR, KEYBIND_YELL, + KEYBIND_QUIT_SAVE, KEYBIND_SPEED_UP, KEYBIND_SPEED_DOWN, + KEYBIND_SPEED_NORMAL, KEYBIND_READY_WEAPON, KEYBIND_SEARCH, + KEYBIND_STATS, KEYBIND_TALK, KEYBIND_TOGGLE_MUSIC, KEYBIND_USE, + KEYBIND_WEAR, KEYBIND_YELL, KEYBIND_NONE };