[Scummvm-git-logs] scummvm master -> 5e1a8301d517f9b51f61a3187f77b65ac90cb169
sev-
noreply at scummvm.org
Fri Feb 7 00:42:46 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
47dd29e443 VIDEO: QTVR: Implement directional cursors for panoramas
5e1a8301d5 VIDEO: QTVR: Implement directional panorama dragging
Commit: 47dd29e443a0c0d20970654d54cfb900d48fc5c7
https://github.com/scummvm/scummvm/commit/47dd29e443a0c0d20970654d54cfb900d48fc5c7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-07T01:20:39+01:00
Commit Message:
VIDEO: QTVR: Implement directional cursors for panoramas
Changed paths:
video/qt_decoder.h
video/qtvr_decoder.cpp
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index e4ca2a60354..2b148427d86 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -79,8 +79,8 @@ public:
void setTargetSize(uint16 w, uint16 h);
void handleMouseMove(int16 x, int16 y);
- void handleMouseButton(bool isDown, int16 x = -1, int16 y = -1);
- void handleKey(Common::KeyState &state, bool down);
+ void handleMouseButton(bool isDown, int16 x = -1, int16 y = -1, bool repeat = false);
+ void handleKey(Common::KeyState &state, bool down, bool repeat = false);
float getPanAngle() const { return _panAngle; }
void setPanAngle(float panAngle) { _panAngle = panAngle; }
@@ -130,12 +130,12 @@ private:
void updateAudioBuffer();
void handleObjectMouseMove(int16 x, int16 y);
- void handleObjectMouseButton(bool isDown, int16 x, int16 y);
+ void handleObjectMouseButton(bool isDown, int16 x, int16 y, bool repeat);
void handlePanoMouseMove(int16 x, int16 y);
- void handlePanoMouseButton(bool isDown, int16 x, int16 y);
+ void handlePanoMouseButton(bool isDown, int16 x, int16 y, bool repeat);
- void handleObjectKey(Common::KeyState &state, bool down);
- void handlePanoKey(Common::KeyState &state, bool down);
+ void handleObjectKey(Common::KeyState &state, bool down, bool repeat);
+ void handlePanoKey(Common::KeyState &state, bool down, bool repeat);
void closeQTVR();
void updateAngles();
@@ -159,6 +159,7 @@ private:
int _currentQTVRCursor = -1;
Common::Archive *_dataBundle = nullptr;
Graphics::Cursor **_cursorCache = nullptr;
+ int _cursorDirMap[256];
bool _isVR;
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 5a0cb304551..1555c9080b5 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -250,17 +250,17 @@ static void repeatCallback(void *data) {
QuickTimeDecoder *decoder = (QuickTimeDecoder *)data;
if (decoder->_isKeyDown)
- decoder->handleKey(decoder->_lastKey, true);
+ decoder->handleKey(decoder->_lastKey, true, true);
if (decoder->_isMouseButtonDown)
- decoder->handleMouseButton(true, decoder->_prevMouseX, decoder->_prevMouseY);
+ decoder->handleMouseButton(true, decoder->_prevMouseX, decoder->_prevMouseY, true);
}
-void QuickTimeDecoder::handleMouseButton(bool isDown, int16 x, int16 y) {
+void QuickTimeDecoder::handleMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
if (_qtvrType == QTVRType::OBJECT)
- handleObjectMouseButton(isDown, x, y);
+ handleObjectMouseButton(isDown, x, y, repeat);
else if (_qtvrType == QTVRType::PANORAMA)
- handlePanoMouseButton(isDown, x, y);
+ handlePanoMouseButton(isDown, x, y, repeat);
if (isDown) {
if (!_repeatTimerActive)
@@ -276,7 +276,7 @@ void QuickTimeDecoder::handleMouseButton(bool isDown, int16 x, int16 y) {
updateQTVRCursor(x, y);
}
-void QuickTimeDecoder::handleObjectMouseButton(bool isDown, int16 x, int16 y) {
+void QuickTimeDecoder::handleObjectMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
if (isDown) {
if (y < _curBbox.top) {
setCurrentRow(getCurrentRow() + 1);
@@ -295,20 +295,20 @@ void QuickTimeDecoder::handleObjectMouseButton(bool isDown, int16 x, int16 y) {
_isMouseButtonDown = isDown;
}
-void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y) {
+void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
_isMouseButtonDown = isDown;
- if (isDown) {
+ if (isDown && !repeat) {
_prevMouseX = x;
_prevMouseY = y;
}
}
-void QuickTimeDecoder::handleKey(Common::KeyState &state, bool down) {
+void QuickTimeDecoder::handleKey(Common::KeyState &state, bool down, bool repeat) {
if (_qtvrType == QTVRType::OBJECT)
- handleObjectKey(state, down);
+ handleObjectKey(state, down, repeat);
else if (_qtvrType == QTVRType::PANORAMA)
- handlePanoKey(state, down);
+ handlePanoKey(state, down, repeat);
if (down) {
_lastKey = state;
@@ -327,10 +327,10 @@ void QuickTimeDecoder::handleKey(Common::KeyState &state, bool down) {
updateQTVRCursor(_prevMouseX, _prevMouseY);
}
-void QuickTimeDecoder::handleObjectKey(Common::KeyState &state, bool down) {
+void QuickTimeDecoder::handleObjectKey(Common::KeyState &state, bool down, bool repeat) {
}
-void QuickTimeDecoder::handlePanoKey(Common::KeyState &state, bool down) {
+void QuickTimeDecoder::handlePanoKey(Common::KeyState &state, bool down, bool repeat) {
if ((state.flags & Common::KBD_SHIFT) && (state.flags & Common::KBD_CTRL)) {
_zoomState = kZoomQuestion;
} else if (state.flags & Common::KBD_SHIFT) {
@@ -648,7 +648,10 @@ enum {
kCurObjRightM90 = 150,
kCurObjUpLimit = 151,
kCurObjDownLimit = 152,
+
kCursorPano = 480,
+ kCursorPanoObjPoint = 484,
+ kCursorPanoObjGrab = 485,
kCursorZoomIn = 500,
kCursorZoomOut = 501,
@@ -656,9 +659,49 @@ enum {
kCursorZoomLimit = 503,
kCursorPanoNav = 510,
+ kCursorPanoL = 511,
+ kCursorPanoLS = 512,
+ kCursorPanoR = 513,
+ kCursorPanoRS = 514,
+ kCursorPanoD = 515,
+ kCursorPanoDS = 516,
+ kCursorPanoU = 525,
+ kCursorPanoUS = 526,
+
+ kCursorPano2 = 540,
+
kCurLastCursor
};
+static const char *keyMatrix[] = {
+ // 76543210
+ "l.......", // 511
+ "lL......", // 512
+ "..r.....", // 513
+ "..rR....", // 514
+ "....d...", // 515
+ "....dD..", // 516
+ "l...d...", // 517
+ "l...dD..", // 518
+ "lL..d...", // 519
+ "lL..dD..", // 520
+ "..r.d...", // 521
+ "..r.dD..", // 522
+ "..rRd...", // 523
+ "..rRdD..", // 524
+ "......u.", // 525
+ "......uU", // 526
+ "l.....u.", // 527
+ "l.....uU", // 528
+ "lL....u.", // 529
+ "lL....uU", // 530
+ "..r...u.", // 531
+ "..r...uU", // 532
+ "..rR..u.", // 533
+ "..rR..uU", // 534
+ 0
+};
+
void QuickTimeDecoder::updateQTVRCursor(int16 x, int16 y) {
if (_qtvrType == QTVRType::OBJECT) {
int tiltIdx = int((-_tiltAngle + 90.0) / 21) * 2;
@@ -693,7 +736,42 @@ void QuickTimeDecoder::updateQTVRCursor(int16 x, int16 y) {
return;
}
- setCursor(_isMouseButtonDown ? kCursorPanoNav : kCursorPano);
+ const int sensitivity = 0;
+
+ if (!_isMouseButtonDown) {
+ setCursor(kCursorPano);
+ } else {
+ int res = 0;
+
+ if (x < _prevMouseX - sensitivity)
+ res |= 1;
+ res <<= 1;
+
+ // left stop
+ res <<= 1;
+
+ if (x > _prevMouseX + sensitivity)
+ res |= 1;
+ res <<= 1;
+
+ // right stop
+ res <<= 1;
+
+ if (y > _prevMouseY - sensitivity)
+ res |= 1;
+ res <<= 1;
+
+ // down stop
+ res <<= 1;
+
+ if (y < _prevMouseY + sensitivity)
+ res |= 1;
+ res <<= 1;
+
+ // up stop
+
+ setCursor(_cursorDirMap[res] ? _cursorDirMap[res] : kCursorPanoNav);
+ }
}
}
@@ -725,7 +803,21 @@ void QuickTimeDecoder::setCursor(int curId) {
if (!_cursorCache) {
_cursorCache = (Graphics::Cursor **)calloc(kCurLastCursor, sizeof(Graphics::Cursor *));
- computeInteractivityZones();
+ memset(_cursorDirMap, 0, 256 * sizeof(int));
+
+ int n = 511;
+ for (const char **p = keyMatrix; *p; p++, n++) {
+ int res = 0;
+
+ for (int i = 0; i < 8; i++) {
+ res <<= 1;
+
+ if ((*p)[i] != '.')
+ res |= 1;
+ }
+
+ _cursorDirMap[res] = n;
+ }
}
if (curId >= kCurLastCursor)
Commit: 5e1a8301d517f9b51f61a3187f77b65ac90cb169
https://github.com/scummvm/scummvm/commit/5e1a8301d517f9b51f61a3187f77b65ac90cb169
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-07T01:42:04+01:00
Commit Message:
VIDEO: QTVR: Implement directional panorama dragging
Changed paths:
video/qt_decoder.h
video/qtvr_decoder.cpp
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 2b148427d86..a38bf6fdfda 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -149,6 +149,7 @@ private:
public:
uint16 _prevMouseX, _prevMouseY;
bool _isMouseButtonDown;
+ Common::Point _mouseDrag;
bool _isKeyDown = false;
Common::KeyState _lastKey;
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 1555c9080b5..0de419cfe85 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -209,39 +209,8 @@ void QuickTimeDecoder::handleObjectMouseMove(int16 x, int16 y) {
}
void QuickTimeDecoder::handlePanoMouseMove(int16 x, int16 y) {
- if (!_isMouseButtonDown)
- return;
-
- PanoTrackHandler *track = (PanoTrackHandler *)_nextVideoTrack;
-
- // HACK: FIXME: Hard coded for now
- const int sensitivity = 10;
- const float speedFactor = 0.5f;
-
- int16 mouseDeltaX = x - _prevMouseX;
- int16 mouseDeltaY = y - _prevMouseY;
-
- float speedX = (float)mouseDeltaX * speedFactor;
- float speedY = (float)mouseDeltaY * speedFactor;
-
- bool changed = false;
-
- if (ABS(mouseDeltaX) >= sensitivity) {
- track->setPanAngle(track->getPanAngle() + speedX);
-
- changed = true;
- }
-
- if (ABS(mouseDeltaY) >= sensitivity) {
- track->setTiltAngle(track->getTiltAngle() + speedY);
-
- changed = true;
- }
-
- if (changed) {
- _prevMouseX = x;
- _prevMouseY = y;
- }
+ _prevMouseX = x;
+ _prevMouseY = y;
}
#define REPEAT_DELAY 100000
@@ -301,7 +270,31 @@ void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y, bool
if (isDown && !repeat) {
_prevMouseX = x;
_prevMouseY = y;
+
+ _mouseDrag.x = x;
+ _mouseDrag.y = y;
}
+
+ if (!repeat)
+ return;
+
+ PanoTrackHandler *track = (PanoTrackHandler *)_nextVideoTrack;
+
+ // HACK: FIXME: Hard coded for now
+ const int sensitivity = 5;
+ const float speedFactor = 0.1f;
+
+ int16 mouseDeltaX = x - _mouseDrag.x;
+ int16 mouseDeltaY = y - _mouseDrag.y;
+
+ float speedX = (float)mouseDeltaX * speedFactor;
+ float speedY = (float)mouseDeltaY * speedFactor;
+
+ if (ABS(mouseDeltaX) >= sensitivity)
+ track->setPanAngle(track->getPanAngle() + speedX);
+
+ if (ABS(mouseDeltaY) >= sensitivity)
+ track->setTiltAngle(track->getTiltAngle() + speedY);
}
void QuickTimeDecoder::handleKey(Common::KeyState &state, bool down, bool repeat) {
@@ -736,35 +729,35 @@ void QuickTimeDecoder::updateQTVRCursor(int16 x, int16 y) {
return;
}
- const int sensitivity = 0;
+ int sensitivity = 5;
if (!_isMouseButtonDown) {
setCursor(kCursorPano);
} else {
int res = 0;
- if (x < _prevMouseX - sensitivity)
+ if (x < _mouseDrag.x - sensitivity)
res |= 1;
res <<= 1;
// left stop
res <<= 1;
- if (x > _prevMouseX + sensitivity)
+ if (x > _mouseDrag.x + sensitivity)
res |= 1;
res <<= 1;
// right stop
res <<= 1;
- if (y > _prevMouseY - sensitivity)
+ if (y > _mouseDrag.y + sensitivity)
res |= 1;
res <<= 1;
// down stop
res <<= 1;
- if (y < _prevMouseY + sensitivity)
+ if (y < _mouseDrag.y - sensitivity)
res |= 1;
res <<= 1;
More information about the Scummvm-git-logs
mailing list