[Scummvm-git-logs] scummvm master -> 8a497658442d0f6464c361c549b59d1e781ac011

sev- noreply at scummvm.org
Wed Feb 19 17:48:43 UTC 2025


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:
e6ea636e93 JANITORIAL: Rearrange methods in the source code
99c992f03a VIDEO: QTVR: Flip panAngle horizontally to follow the original
8a49765844 VIDEO: QTVR: Flip tiltAngle vertically to follow the original


Commit: e6ea636e93938f2e791d6a9862e12d1e8ae5077c
    https://github.com/scummvm/scummvm/commit/e6ea636e93938f2e791d6a9862e12d1e8ae5077c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-19T18:37:39+01:00

Commit Message:
JANITORIAL: Rearrange methods in the source code

Changed paths:
    video/qtvr_decoder.cpp


diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 24953ea494c..5143c5bafe7 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -931,6 +931,70 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 	_dirty = false;
 }
 
+Common::Point QuickTimeDecoder::getPanLoc(int16 x, int16 y) {
+	PanoTrackHandler *track = (PanoTrackHandler *)getTrack(_panoTrack->targetTrack);
+
+	return track->projectPoint(x, y);
+}
+
+Graphics::FloatPoint QuickTimeDecoder::getPanAngles(int16 x, int16 y) {
+	PanoTrackHandler *track = (PanoTrackHandler *)getTrack(_panoTrack->targetTrack);
+	PanoSampleDesc *desc = (PanoSampleDesc *)_panoTrack->sampleDescs[0];
+	Common::Point pos = track->projectPoint(x, y);
+
+	Graphics::FloatPoint res;
+
+	res.x = desc->_hPanStart + (desc->_hPanStart - desc->_hPanEnd) / (float)desc->_sceneSizeY * pos.x;
+	res.y = desc->_vPanTop + (desc->_vPanTop - desc->_vPanBottom) / (float)desc->_sceneSizeX * pos.y;
+
+	return res;
+}
+
+void QuickTimeDecoder::lookupHotspot(int16 x, int16 y) {
+	PanoTrackHandler *track = (PanoTrackHandler *)getTrack(_panoTrack->targetTrack);
+
+	Common::Point hotspotPoint = track->projectPoint(x, y);
+
+	if (hotspotPoint.x < 0) {
+		_rolloverHotspot = nullptr;
+	} else {
+		int hotspotId = (int)(((PanoTrackHandler *)getTrack(_panoTrack->targetTrack))->_constructedHotspots->getPixel(hotspotPoint.y, hotspotPoint.x));
+
+
+		if (hotspotId && _currentSample != -1) {
+			if (!_rolloverHotspot || _rolloverHotspot->id != hotspotId)
+				_rolloverHotspot = _panoTrack->panoSamples[_currentSample].hotSpotTable.get(hotspotId);
+		} else {
+			_rolloverHotspot = nullptr;
+		}
+	}
+}
+
+Common::String QuickTimeDecoder::getHotSpotName(int id) {
+	if (id <= 0)
+		return "";
+
+	PanoHotSpot *hotspot = _panoTrack->panoSamples[_currentSample].hotSpotTable.get(id);
+
+	return _panoTrack->panoSamples[_currentSample].strTable.getString(hotspot->nameStrOffset);
+}
+
+const QuickTimeDecoder::PanoHotSpot *QuickTimeDecoder::getHotSpotByID(int id) {
+	return _panoTrack->panoSamples[_currentSample].hotSpotTable.get(id);
+}
+
+const QuickTimeDecoder::PanoNavigation *QuickTimeDecoder::getHotSpotNavByID(int id) {
+	const QuickTimeDecoder::PanoHotSpot *hotspot = getHotSpotByID(id);
+
+	if (hotspot->type != HotSpotType::navg)
+		return nullptr;
+
+	return _panoTrack->panoSamples[_currentSample].navTable.get(hotspot->typeData);
+}
+
+void QuickTimeDecoder::setClickedHotSpot(int id) {
+	_clickedHotspot = getHotSpotByID(id);
+}
 
 
 ///////////////////////////////
@@ -1162,71 +1226,6 @@ void QuickTimeDecoder::handlePanoKey(Common::KeyState &state, bool down, bool re
 	}
 }
 
-Common::Point QuickTimeDecoder::getPanLoc(int16 x, int16 y) {
-	PanoTrackHandler *track = (PanoTrackHandler *)getTrack(_panoTrack->targetTrack);
-
-	return track->projectPoint(x, y);
-}
-
-Graphics::FloatPoint QuickTimeDecoder::getPanAngles(int16 x, int16 y) {
-	PanoTrackHandler *track = (PanoTrackHandler *)getTrack(_panoTrack->targetTrack);
-	PanoSampleDesc *desc = (PanoSampleDesc *)_panoTrack->sampleDescs[0];
-	Common::Point pos = track->projectPoint(x, y);
-
-	Graphics::FloatPoint res;
-
-	res.x = desc->_hPanStart + (desc->_hPanStart - desc->_hPanEnd) / (float)desc->_sceneSizeY * pos.x;
-	res.y = desc->_vPanTop + (desc->_vPanTop - desc->_vPanBottom) / (float)desc->_sceneSizeX * pos.y;
-
-	return res;
-}
-
-void QuickTimeDecoder::lookupHotspot(int16 x, int16 y) {
-	PanoTrackHandler *track = (PanoTrackHandler *)getTrack(_panoTrack->targetTrack);
-
-	Common::Point hotspotPoint = track->projectPoint(x, y);
-
-	if (hotspotPoint.x < 0) {
-		_rolloverHotspot = nullptr;
-	} else {
-		int hotspotId = (int)(((PanoTrackHandler *)getTrack(_panoTrack->targetTrack))->_constructedHotspots->getPixel(hotspotPoint.y, hotspotPoint.x));
-
-
-		if (hotspotId && _currentSample != -1) {
-			if (!_rolloverHotspot || _rolloverHotspot->id != hotspotId)
-				_rolloverHotspot = _panoTrack->panoSamples[_currentSample].hotSpotTable.get(hotspotId);
-		} else {
-			_rolloverHotspot = nullptr;
-		}
-	}
-}
-
-Common::String QuickTimeDecoder::getHotSpotName(int id) {
-	if (id <= 0)
-		return "";
-
-	PanoHotSpot *hotspot = _panoTrack->panoSamples[_currentSample].hotSpotTable.get(id);
-
-	return _panoTrack->panoSamples[_currentSample].strTable.getString(hotspot->nameStrOffset);
-}
-
-const QuickTimeDecoder::PanoHotSpot *QuickTimeDecoder::getHotSpotByID(int id) {
-	return _panoTrack->panoSamples[_currentSample].hotSpotTable.get(id);
-}
-
-const QuickTimeDecoder::PanoNavigation *QuickTimeDecoder::getHotSpotNavByID(int id) {
-	const QuickTimeDecoder::PanoHotSpot *hotspot = getHotSpotByID(id);
-
-	if (hotspot->type != HotSpotType::navg)
-		return nullptr;
-
-	return _panoTrack->panoSamples[_currentSample].navTable.get(hotspot->typeData);
-}
-
-void QuickTimeDecoder::setClickedHotSpot(int id) {
-	_clickedHotspot = getHotSpotByID(id);
-}
-
 enum {
 	kCurHand = 129,
 	kCurGrab = 130,


Commit: 99c992f03aa972c39ee7ed23678d31620d27134b
    https://github.com/scummvm/scummvm/commit/99c992f03aa972c39ee7ed23678d31620d27134b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-19T18:43:02+01:00

Commit Message:
VIDEO: QTVR: Flip panAngle horizontally to follow the original

Changed paths:
    video/qtvr_decoder.cpp


diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 5143c5bafe7..995d2e55204 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -694,7 +694,7 @@ Common::Point QuickTimeDecoder::PanoTrackHandler::projectPoint(int16 mx, int16 m
 	float yawAngle = atan2(mousePixelVector[0], mousePixelVector[2]);
 
 	// panorama is turned 90 degrees, width is height
-	int hotX = (1.0f - (yawAngle / (2.0 * M_PI) + _decoder->_panAngle / 360.0f)) * (float)_constructedHotspots->h;
+	int hotX = (1.0f - (yawAngle / (2.0 * M_PI) + (360.0f - _decoder->_panAngle) / 360.0f)) * (float)_constructedHotspots->h;
 
 	hotX = hotX % _constructedHotspots->h;
 	if (hotX < 0)
@@ -839,7 +839,7 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 		cylinderAngleOffsets[x] = atan(xCoord) * 0.5f / M_PI;
 	}
 
-	float angleT = fmod(_decoder->_panAngle / 360.0, 1.0);
+	float angleT = fmod((360.0f - _decoder->_panAngle) / 360.0f, 1.0f);
 	if (angleT < 0.0f)
 		angleT += 1.0f;
 
@@ -1157,7 +1157,7 @@ void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y, bool
 	float speedY = (float)mouseDeltaY * speedFactor;
 
 	if (ABS(mouseDeltaX) >= sensitivity)
-		setPanAngle(getPanAngle() + speedX);
+		setPanAngle(getPanAngle() - speedX);
 
 	if (ABS(mouseDeltaY) >= sensitivity)
 		setTiltAngle(getTiltAngle() + speedY);


Commit: 8a497658442d0f6464c361c549b59d1e781ac011
    https://github.com/scummvm/scummvm/commit/8a497658442d0f6464c361c549b59d1e781ac011
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-19T18:47:54+01:00

Commit Message:
VIDEO: QTVR: Flip tiltAngle vertically to follow the original

Now the angles are matching, thus, the object locations are correct

Changed paths:
    video/qtvr_decoder.cpp


diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 995d2e55204..4aaf9fed678 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -661,8 +661,8 @@ Common::Point QuickTimeDecoder::PanoTrackHandler::projectPoint(int16 mx, int16 m
 	topRightVector[2] = bottomRightVector[2];
 
 	// Apply pitch (tilt) rotation
-	float cosTilt = cos(_decoder->_tiltAngle * M_PI / 180.0);
-	float sinTilt = sin(_decoder->_tiltAngle * M_PI / 180.0);
+	float cosTilt = cos(-_decoder->_tiltAngle * M_PI / 180.0);
+	float sinTilt = sin(-_decoder->_tiltAngle * M_PI / 180.0);
 
 	for (int v = 0; v < 2; v++) {
 		float y = cornerVectors[v][1];
@@ -752,8 +752,8 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 	topRightVector[2] = bottomRightVector[2];
 
 	// Apply pitch (tilt) rotation
-	float cosTilt = cos(_decoder->_tiltAngle * M_PI / 180.0);
-	float sinTilt = sin(_decoder->_tiltAngle * M_PI / 180.0);
+	float cosTilt = cos(-_decoder->_tiltAngle * M_PI / 180.0);
+	float sinTilt = sin(-_decoder->_tiltAngle * M_PI / 180.0);
 
 	for (int v = 0; v < 2; v++) {
 		float y = cornerVectors[v][1];
@@ -1160,7 +1160,7 @@ void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y, bool
 		setPanAngle(getPanAngle() - speedX);
 
 	if (ABS(mouseDeltaY) >= sensitivity)
-		setTiltAngle(getTiltAngle() + speedY);
+		setTiltAngle(getTiltAngle() - speedY);
 }
 
 void QuickTimeDecoder::handleKey(Common::KeyState &state, bool down, bool repeat) {




More information about the Scummvm-git-logs mailing list