diff --git a/gui/console.cpp b/gui/console.cpp index b03a2a7d93b..61f0d1b8471 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -121,6 +121,16 @@ void ConsoleDialog::init() { _pageWidth = (_w - scrollBarWidth - 2 - _leftPadding - _topPadding - scrollBarWidth) / kConsoleCharWidth; _linesPerPage = (_h - 2 - _topPadding - _bottomPadding) / kConsoleLineHeight; _linesInBuffer = kBufferSize / kCharsPerLine; + + resetPrompt(); +} + +void ConsoleDialog::setPrompt(Common::String prompt) { + _prompt = prompt; +} + +void ConsoleDialog::resetPrompt() { + _prompt = PROMPT; } void ConsoleDialog::slideUpAndClose() { @@ -159,7 +169,7 @@ void ConsoleDialog::open() { if ((_promptStartPos == -1) || (_currentPos > _promptEndPos)) { // we print a prompt, if this is the first time we are called or if the // engine wrote onto us since the last call - print(PROMPT); + print(_prompt.c_str()); _promptStartPos = _promptEndPos = _currentPos; } @@ -283,7 +293,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) { keepRunning = (*_callbackProc)(this, userInput.c_str(), _callbackRefCon); } - print(PROMPT); + print(_prompt.c_str()); _promptStartPos = _promptEndPos = _currentPos; g_gui.scheduleTopDialogRedraw(); diff --git a/gui/console.h b/gui/console.h index 01effcfe5e5..97b5ca62271 100644 --- a/gui/console.h +++ b/gui/console.h @@ -129,6 +129,8 @@ protected: void slideUpAndClose(); + Common::String _prompt; + public: ConsoleDialog(float widthPercent, float heightPercent); virtual ~ConsoleDialog(); @@ -161,6 +163,9 @@ public: return _pageWidth; } + void setPrompt(Common::String prompt); + void resetPrompt(); + protected: inline char &buffer(int idx) { return _buffer[idx % kBufferSize]; diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 24d1176e84a..0a89c950ca2 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -92,6 +92,18 @@ void Debugger::clearVars() { } +void Debugger::setPrompt(Common::String prompt) { +#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER + _debuggerDialog->setPrompt(prompt); +#endif +} + +void Debugger::resetPrompt() { +#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER + _debuggerDialog->resetPrompt(); +#endif +} + // Initialisation Functions int Debugger::getCharsPerLine() { #ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER diff --git a/gui/debugger.h b/gui/debugger.h index d06eaf5cea0..24fb705c93c 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -168,6 +168,9 @@ protected: */ void clearVars(); + void setPrompt(Common::String prompt); + void resetPrompt(); + private: /** * The frame countdown specifies a number of frames that must pass