aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agi/agi.cpp4
-rw-r--r--engines/agi/agi.h2
-rw-r--r--engines/agi/keyboard.cpp9
-rw-r--r--engines/agi/op_cmd.cpp16
-rw-r--r--engines/agi/saveload.cpp19
5 files changed, 36 insertions, 14 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 79047b0b84..933aa50b1c 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -173,7 +173,7 @@ int AgiEngine::agiInit() {
// GUI Predictive Dialog, but DS Word Completion is probably broken due to this...
#endif
- _egoHoldKey = false;
+ _keyHoldMode = false;
_game.mouseFence.setWidth(0); // Reset
@@ -403,7 +403,7 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas
_systemUI = nullptr;
_inventory = nullptr;
- _egoHoldKey = false;
+ _keyHoldMode = false;
}
void AgiEngine::initialize() {
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index ea70127d45..93017af099 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -907,7 +907,7 @@ public:
void updatePosition();
int getDirection(int16 objX, int16 objY, int16 destX, int16 destY, int16 stepSize);
- bool _egoHoldKey;
+ bool _keyHoldMode;
// Keyboard
int doPollKeyboard();
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index 5ef6dd256f..5a73afe6fb 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -252,8 +252,13 @@ void AgiEngine::processScummVMEvents() {
break;
case Common::EVENT_KEYUP:
- if (_egoHoldKey)
- _game.screenObjTable[SCREENOBJECTS_EGO_ENTRY].direction = 0;
+ if (_keyHoldMode) {
+ // Original AGI actually created direction events in here
+ // We don't do that, that's why we create a stationary event instead, which will
+ // result in a direction change to 0 in handleController().
+ keyEnqueue(AGI_KEY_STATIONARY);
+ }
+ break;
default:
break;
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 7d4b7591d9..edbbb4e1a7 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -934,12 +934,6 @@ void cmdPopScript(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
}
}
-void cmdHoldKey(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
- if (getVersion() >= 0x3098) {
- state->_vm->_egoHoldKey = true;
- }
-}
-
void cmdDiscardSound(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
if (getVersion() >= 0x2936) {
debug(0, "discard.sound");
@@ -993,9 +987,17 @@ void cmdFenceMouse(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
state->mouseFence.setHeight(varNr4 - varNr1);
}
+// HoldKey was added in 2.425
+// There was no way to disable this mode until 3.098 though
+void cmdHoldKey(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
+ if (getVersion() >= 0x2425) {
+ vm->_keyHoldMode = true;
+ }
+}
+
void cmdReleaseKey(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
if (getVersion() >= 0x3098) {
- state->_vm->_egoHoldKey = false;
+ vm->_keyHoldMode = false;
}
}
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index c2d9de8bb2..1bf0dbcc02 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -45,7 +45,7 @@
#include "agi/systemui.h"
#include "agi/words.h"
-#define SAVEGAME_CURRENT_VERSION 7
+#define SAVEGAME_CURRENT_VERSION 8
//
// Version 0 (Sarien): view table has 64 entries
@@ -59,7 +59,9 @@
// required for some games for quick-loading from ScummVM main menu
// for games, that do not set all key mappings right at the start
// Added automatic save data (for command SetSimple)
-//
+// Version 8 (ScummVM): Added Hold-Key-Mode boolean
+// required for at least Mixed Up Mother Goose
+// gets set at the start of the game only
namespace Agi {
@@ -195,6 +197,10 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
out->writeByte(_game.controllerKeyMapping[i].controllerSlot);
}
+ // Version 8+: hold-key-mode
+ // required for at least Mixed Up Mother Goose
+ out->writeByte(_keyHoldMode);
+
// game.ev_keyp
for (i = 0; i < MAX_STRINGS; i++)
out->write(_game.strings[i], MAX_STRINGLEN);
@@ -521,6 +527,15 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
}
}
+ if (saveVersion >= 8) {
+ // Version 8+: hold-key-mode
+ if (in->readByte()) {
+ _keyHoldMode = true;
+ } else {
+ _keyHoldMode = false;
+ }
+ }
+
for (i = 0; i < MAX_STRINGS; i++)
in->read(_game.strings[i], MAX_STRINGLEN);