TWINE: fixed endless magic ball action when console was activated

related to https://bugs.scummvm.org/ticket/13675
This commit is contained in:
Martin Gerhardy 2022-09-29 04:55:37 +02:00
parent 9d6562189d
commit 796f54ff89
4 changed files with 22 additions and 0 deletions

View File

@ -78,6 +78,16 @@ TwinEConsole::TwinEConsole(TwinEEngine *engine) : _engine(engine), GUI::Debugger
TwinEConsole::~TwinEConsole() {
}
void TwinEConsole::preEnter() {
_engine->_input->resetActionStates();
Super::preEnter();
}
void TwinEConsole::postEnter() {
_engine->_input->resetActionStates();
Super::postEnter();
}
#define TOGGLE_DEBUG(var, description) \
if ((var)) { \
debugPrintf("Disabling " description); \

View File

@ -31,6 +31,7 @@ class TwinEEngine;
class TwinEConsole : public GUI::Debugger {
private:
using Super = GUI::Debugger;
TwinEEngine *_engine;
bool doToggleSceneryView(int argc, const char **argv);
@ -70,6 +71,10 @@ private:
bool doDumpFile(int argc, const char **argv);
bool doSetHolomapTrajectory(int argc, const char **argv);
protected:
void preEnter() override;
void postEnter() override;
public:
TwinEConsole(TwinEEngine *engine);
~TwinEConsole() override;

View File

@ -62,6 +62,12 @@ bool Input::toggleActionIfActive(TwinEActionType actionType) {
return false;
}
void Input::resetActionStates() {
for (int i = 0; i < TwinEActionType::Max; ++i) {
_actionStates[i] = false;
}
}
bool Input::toggleAbortAction() {
bool abortState = false;
abortState |= toggleActionIfActive(TwinEActionType::CutsceneAbort);

View File

@ -143,6 +143,7 @@ public:
* @c true anymore
*/
bool toggleActionIfActive(TwinEActionType actionType);
void resetActionStates();
bool toggleAbortAction();