[Scummvm-git-logs] scummvm branch-2-1 -> e6abef455f13dbc296780b6170645d03d65887f7
athrxx
athrxx at scummvm.org
Wed Jan 8 19:33:41 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
21c90076d4 GRAPHICS: (really) fix screen shake x/y offsets
b1b24bca2d KYRA: (LOK) - shakeScreen() improvement
e6abef455f KYRA: (LOK) - fix mouse cursor bug (see #11303)
Commit: 21c90076d481a4371a0a8bf01bca007d29359afd
https://github.com/scummvm/scummvm/commit/21c90076d481a4371a0a8bf01bca007d29359afd
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-08T20:32:44+01:00
Commit Message:
GRAPHICS: (really) fix screen shake x/y offsets
I confused window w/h with actual drawing w/h. And obviously forgot to test stretch modes like "Center". Now these modes also seem to work pixel exact...
Changed paths:
backends/graphics/windowed.h
diff --git a/backends/graphics/windowed.h b/backends/graphics/windowed.h
index 6d5884b..f94471d 100644
--- a/backends/graphics/windowed.h
+++ b/backends/graphics/windowed.h
@@ -397,8 +397,8 @@ private:
}
}
- drawRect.left = ((_windowWidth - width) / 2) + _gameScreenShakeXOffset * _windowWidth / getWidth();
- drawRect.top = ((_windowHeight - height) / 2) + _gameScreenShakeYOffset * _windowHeight / getHeight();
+ drawRect.left = ((_windowWidth - width) / 2) + _gameScreenShakeXOffset * width / getWidth();
+ drawRect.top = ((_windowHeight - height) / 2) + _gameScreenShakeYOffset * height / getHeight();
drawRect.setWidth(width);
drawRect.setHeight(height);
}
Commit: b1b24bca2dfab06033ebf63d1671c5c9e7d28821
https://github.com/scummvm/scummvm/commit/b1b24bca2dfab06033ebf63d1671c5c9e7d28821
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-08T20:32:44+01:00
Commit Message:
KYRA: (LOK) - shakeScreen() improvement
(maintain smooth mouse cursor movement during shakes)
Changed paths:
engines/kyra/graphics/screen.cpp
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index bc59062..4d6e397 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -3225,7 +3225,7 @@ void Screen::shakeScreen(int times) {
const int8 *data = _shakeParaPC;
int steps = ARRAYSIZE(_shakeParaPC) / 3;
-
+
// The FM-TOWNS version has a slightly better shake animation
// TODO: check PC-98 version
if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
@@ -3233,16 +3233,28 @@ void Screen::shakeScreen(int times) {
steps = ARRAYSIZE(_shakeParaFMTOWNS) / 3;
}
+ Common::Event event;
+
while (times--) {
for (int i = 0; i < steps; ++i) {
- // The original PC version did not need an artificial delay, but we do.
- // Or the shake will be too fast to be actually seen.
- uint32 delayuntil = _system->getMillis() + data[0];
+ // The original PC version did not need an artificial delay, but we do or the shake will be
+ // too fast to be actually seen.
+ uint32 end = _system->getMillis() + data[0];
_system->setShakePos(data[1], data[2]);
- _system->updateScreen();
- int diff = delayuntil - _system->getMillis();
- if (diff > 0)
- _system->delayMillis(diff);
+
+ for (uint32 now = _system->getMillis(); now < end; ) {
+ // Update the event manager to keep smooth mouse pointer movement.
+ while (_vm->getEventManager()->pollEvent(event)) {
+ if (event.type == Common::EVENT_KEYDOWN) {
+ // This is really the only thing that should be handled.
+ if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.hasFlags(Common::KBD_CTRL))
+ _vm->quitGame();
+ }
+ }
+ _system->updateScreen();
+ now = _system->getMillis();
+ _system->delayMillis(MIN<uint>(end - now, 10));
+ }
data += 3;
}
}
Commit: e6abef455f13dbc296780b6170645d03d65887f7
https://github.com/scummvm/scummvm/commit/e6abef455f13dbc296780b6170645d03d65887f7
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-08T20:32:45+01:00
Commit Message:
KYRA: (LOK) - fix mouse cursor bug (see #11303)
Changed paths:
engines/kyra/engine/kyra_v1.cpp
engines/kyra/script/script_v1.cpp
diff --git a/engines/kyra/engine/kyra_v1.cpp b/engines/kyra/engine/kyra_v1.cpp
index ede2e61..3158ea1 100644
--- a/engines/kyra/engine/kyra_v1.cpp
+++ b/engines/kyra/engine/kyra_v1.cpp
@@ -235,6 +235,19 @@ void KyraEngine_v1::setMousePos(int x, int y) {
y <<= 1;
}
_system->warpMouse(x, y);
+
+ // Feed the event manager an artficial mouse move event, since warpMouse() won't generate one.
+ // From the warpMouse comments I gather that this behavior is intentional due to requirements of
+ // the SCUMM engine. In KYRA we need to get the same coordinates from _eventMan->getMousePos()
+ // that we send via warpMouse(). We have script situations in Kyra (like the Alchemists' crystals
+ // scene) where a new mouse cursor position is set and then immediately read. This function would
+ // then get wrong coordinates.
+ Common::Event event;
+ event.type = Common::EVENT_MOUSEMOVE;
+ event.mouse.x = x;
+ event.mouse.y = y;
+ _eventMan->pushEvent(event);
+ updateInput();
}
int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) {
diff --git a/engines/kyra/script/script_v1.cpp b/engines/kyra/script/script_v1.cpp
index 2fbd2f2..356460d 100644
--- a/engines/kyra/script/script_v1.cpp
+++ b/engines/kyra/script/script_v1.cpp
@@ -65,7 +65,7 @@ int KyraEngine_v1::o1_showMouse(EMCState *script) {
int KyraEngine_v1::o1_setMousePos(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- _system->warpMouse(stackPos(0), stackPos(1));
+ setMousePos(stackPos(0), stackPos(1));
return 0;
}
More information about the Scummvm-git-logs
mailing list