diff --git a/engines/myst3/gfx.cpp b/engines/myst3/gfx.cpp index 843535e6b23..06f4f322167 100644 --- a/engines/myst3/gfx.cpp +++ b/engines/myst3/gfx.cpp @@ -285,7 +285,7 @@ void Renderer::draw2DText(const Common::String &text, const Common::Point &posit glVertex3f(x, y + h, 1.0f); glEnd(); - x += textureRect.width() - 2; + x += textureRect.width() - 3; } glDisable(GL_TEXTURE_2D); diff --git a/engines/myst3/menu.cpp b/engines/myst3/menu.cpp index 2fe133e1f7d..f9e819b447d 100644 --- a/engines/myst3/menu.cpp +++ b/engines/myst3/menu.cpp @@ -483,6 +483,38 @@ void Menu::draw() { } } +void Menu::handleInput(const Common::KeyState &e) { + uint16 node = _vm->_state->getLocationNode(); + uint16 room = _vm->_state->getLocationRoom(); + uint16 item = _vm->_state->getMenuSaveLoadSelectedItem(); + + if (room != 901 || node != 300 || item != 7) + return; + + Common::String display = prepareSaveNameForDisplay(_saveName); + + if (e.keycode == Common::KEYCODE_BACKSPACE + || e.keycode == Common::KEYCODE_DELETE) { + display.deleteLastChar(); + _saveName = display; + return; + } else if (e.keycode == Common::KEYCODE_RETURN + || e.keycode == Common::KEYCODE_KP_ENTER) { + saveMenuSave(); + return; + } + + if ((e.ascii >= 'a' && e.ascii <= 'z' + || e.ascii >= 'A' && e.ascii <= 'Z' + || e.ascii >= '0' && e.ascii <= '9' + || e.ascii == ' ') + && (display.size() < 17)) { + display += e.ascii; + display.toUppercase(); + _saveName = display; + } +} + void Menu::loadMenuChangePage() { saveLoadUpdateVars(); } diff --git a/engines/myst3/menu.h b/engines/myst3/menu.h index daf322ce477..9e866255163 100644 --- a/engines/myst3/menu.h +++ b/engines/myst3/menu.h @@ -25,6 +25,7 @@ #include "engines/myst3/gfx.h" +#include "common/events.h" #include "common/memstream.h" #include "common/rect.h" #include "common/savefile.h" @@ -44,6 +45,7 @@ public: virtual ~Menu(); void draw(); + void handleInput(const Common::KeyState &e); void updateMainMenu(uint16 action); void goToNode(uint16 node); diff --git a/engines/myst3/myst3.cpp b/engines/myst3/myst3.cpp index ca53fc8dd00..6578472b1a3 100644 --- a/engines/myst3/myst3.cpp +++ b/engines/myst3/myst3.cpp @@ -271,6 +271,9 @@ void Myst3Engine::processInput(bool lookOnly) { } } else if (event.type == Common::EVENT_KEYDOWN) { + // Save file name input + _menu->handleInput(event.kbd); + switch (event.kbd.keycode) { case Common::KEYCODE_ESCAPE: // Open main menu