[Scummvm-git-logs] scummvm master -> 24d0159e799d82b6305fc4dd968faf8e9c3b3c9a
athrxx
athrxx at scummvm.org
Wed Jan 8 19:29:04 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:
2f919d39e4 GRAPHICS: (really) fix screen shake x/y offsets
ec872b8dc8 KYRA: (LOK) - shakeScreen() improvement
24d0159e79 KYRA: (LOK) - fix mouse cursor bug (see #11303)
Commit: 2f919d39e4b9ae0cb1f66b97b29a00525619b4c1
https://github.com/scummvm/scummvm/commit/2f919d39e4b9ae0cb1f66b97b29a00525619b4c1
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-08T20:27:53+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 bea4522..9911527 100644
--- a/backends/graphics/windowed.h
+++ b/backends/graphics/windowed.h
@@ -406,8 +406,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: ec872b8dc8fffc631b9b5e84c701800a20d02220
https://github.com/scummvm/scummvm/commit/ec872b8dc8fffc631b9b5e84c701800a20d02220
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-08T20:27:54+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 dd264a1..bbcada5 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -3175,7 +3175,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) {
@@ -3183,16 +3183,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: 24d0159e799d82b6305fc4dd968faf8e9c3b3c9a
https://github.com/scummvm/scummvm/commit/24d0159e799d82b6305fc4dd968faf8e9c3b3c9a
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-08T20:27:54+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 fc43919..c708756 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