[Scummvm-git-logs] scummvm master -> 71f1ac9e212846937338e6e8b7ef0decb96a4d87

whoozle noreply at scummvm.org
Tue Mar 10 01:42:42 UTC 2026


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
dcbd605574 PHOENIXVR: implement interpolate, pass zoom in radians
71f1ac9e21 PHOENIXVR: fabs/std::abs fixup


Commit: dcbd605574114ea4568294c5533e886d02f90651
    https://github.com/scummvm/scummvm/commit/dcbd605574114ea4568294c5533e886d02f90651
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-03-10T01:40:17Z

Commit Message:
PHOENIXVR: implement interpolate, pass zoom in radians

Changed paths:
    engines/phoenixvr/commands.h
    engines/phoenixvr/phoenixvr.cpp
    engines/phoenixvr/phoenixvr.h
    engines/phoenixvr/script.cpp
    engines/phoenixvr/script.h


diff --git a/engines/phoenixvr/commands.h b/engines/phoenixvr/commands.h
index 89a92bf1d6f..615d801ae3c 100644
--- a/engines/phoenixvr/commands.h
+++ b/engines/phoenixvr/commands.h
@@ -953,8 +953,8 @@ struct LockKey : public Script::Command {
 };
 
 struct SetZoom : public Script::Command {
-	int fov;
-	SetZoom(int f) : fov(f) {}
+	float fov;
+	SetZoom(float f) : fov(f) {}
 
 	void exec(Script::ExecutionContext &ctx) const override {
 		g_engine->setZoom(fov);
@@ -1007,13 +1007,12 @@ struct SetNord : public Script::Command {
 };
 
 struct InterpolAngle : public Script::Command {
-	float x, y;
-	int unk;
-	int zoom;
-	InterpolAngle(float x_, float y_, int u, int z) : x(x_), y(y_), unk(u), zoom(z) {}
+	float x, y, speed, zoom;
+
+	InterpolAngle(float x_, float y_, float s, float z) : x(x_), y(y_), speed(s), zoom(z) {}
 
 	void exec(Script::ExecutionContext &ctx) const override {
-		warning("interpolangle %g,%g %d %d", x, y, unk, zoom);
+		g_engine->interpolateAngle(x, y, speed, zoom);
 	}
 };
 
diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index e0696d7942d..b458e86b885 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -210,6 +210,62 @@ void PhoenixVREngine::end() {
 	}
 }
 
+void PhoenixVREngine::interpolateAngle(float x, float y, float speed, float zoom) {
+	debug("interpolateAngle %g,%g, speed: %g, zoom: %g", x, y, speed, zoom);
+	Graphics::FrameLimiter limiter(g_system, kFPSLimit);
+	unsigned frameDuration = 0;
+	static constexpr float kDuration = 4096 * 16 / 1000.0f;
+	auto x0 = _angleY.angle() + kPi2, y0 = _angleX.angle(), z0 = _fov;
+	auto dx = x - x0, dy = y - y0, dz = zoom - z0;
+	if (dy < -kPi)
+		dy += kTau;
+	if (dy > kPi)
+		dy -= kTau;
+	if (dx < -kPi)
+		dx += kTau;
+	if (dx > kPi)
+		dx -= kTau;
+	debug("dx: %g, dy: %g, dz: %g", dx, dy, dz);
+	float t = 0;
+	bool waiting = true;
+	while (!shouldQuit() && waiting && t < kDuration) {
+		auto t1 = t / kDuration; // normalise to 0..1 range
+		// angles are animated using square function, zoom is linear
+		auto t2 = t1 * t1;
+
+		setAngle(x0 + 0 * dx, y0 + t2 * dy);
+		if (zoom > 0) {
+			setZoom(z0 + t1 * dz);
+		}
+
+		renderVR(frameDuration / 1000.0f);
+
+		Common::Event event;
+		while (g_system->getEventManager()->pollEvent(event)) {
+			switch (event.type) {
+			case Common::EVENT_KEYDOWN: {
+				if (event.kbd.ascii == ' ') {
+					waiting = false;
+				}
+				break;
+			}
+			default:
+				break;
+			}
+		}
+
+		// Delay for a bit. All events loops should have a delay
+		// to prevent the system being unduly loaded
+		limiter.delayBeforeSwap();
+		_screen->update();
+		frameDuration = limiter.startFrame();
+		t += frameDuration / 1000.0f * speed;
+	}
+	setAngle(x, y);
+	if (zoom > 0)
+		setZoom(zoom);
+}
+
 void PhoenixVREngine::until(const Common::String &var, int value) {
 	debug("until %s %d", var.c_str(), value);
 	Graphics::FrameLimiter limiter(g_system, kFPSLimit);
@@ -1008,6 +1064,7 @@ Common::Error PhoenixVREngine::run() {
 			}
 		}
 		float dt = float(frameDuration) / 1000.0f;
+		debug("tick %g", dt);
 		tick(dt);
 
 		// Delay for a bit. All events loops should have a delay
diff --git a/engines/phoenixvr/phoenixvr.h b/engines/phoenixvr/phoenixvr.h
index 17ee13a79c1..3181252e92c 100644
--- a/engines/phoenixvr/phoenixvr.h
+++ b/engines/phoenixvr/phoenixvr.h
@@ -138,9 +138,10 @@ public:
 	void killTimer();
 	void playAnimation(const Common::String &name, const Common::String &var, int varValue, float speed);
 	void stopAnimation(const Common::String &name);
-	void setZoom(int fov) {
-		_fov = kPi * fov / 180;
+	void setZoom(float fov) {
+		_fov = fov;
 	}
+	void interpolateAngle(float x, float y, float speed, float zoom);
 
 	void setXMax(float max) {
 		static const float baseX = -kPi2;
diff --git a/engines/phoenixvr/script.cpp b/engines/phoenixvr/script.cpp
index e4b8557c644..98d429502cc 100644
--- a/engines/phoenixvr/script.cpp
+++ b/engines/phoenixvr/script.cpp
@@ -166,12 +166,9 @@ public:
 			auto arg2 = nextInt();
 			return CommandPtr(new Fade(arg0, arg1, arg2));
 		} else if (maybe("setzoom=")) {
-			return CommandPtr(new SetZoom(nextInt()));
+			return CommandPtr(new SetZoom(toRadian(nextInt())));
 		} else if (maybe("setangle=") || keyword("setangle")) {
-			auto i0 = nextInt();
-			if (i0 > 4095)
-				i0 -= 8192;
-			auto a0 = toAngle(i0);
+			auto a0 = toAngle(nextInt());
 			expect(',');
 			auto a1 = toAngle(nextInt());
 			return CommandPtr(new SetAngle(a0, a1));
@@ -181,18 +178,18 @@ public:
 		} else if (keyword("interpolangle") || keyword("interpolanglezoom")) {
 			maybe(',');
 			maybe('=');
-			auto i0 = nextInt();
-			if (i0 > 4095)
-				i0 -= 8192;
-			auto a0 = toAngle(i0);
+			auto a0 = toAngle(nextInt());
 			expect(',');
 			auto a1 = toAngle(nextInt());
 			expect(',');
-			int unk = nextInt();
-			int zoom = 0;
+			float a2 = nextInt();
+			float a3 = 0;
 			if (maybe(','))
-				zoom = nextInt();
-			return CommandPtr(new InterpolAngle(a0, a1, unk, zoom));
+				a3 = nextInt();
+			// x, y, speed
+			// or
+			// x, y, zoom, speed
+			return CommandPtr(a3 != 0 ? new InterpolAngle(a0, a1, a3, toRadian(a2)) : new InterpolAngle(a0, a1, a2, 0));
 		} else if (maybe("anglexmax=")) {
 			return CommandPtr(new AngleXMax(toAngle(nextInt())));
 		} else if (maybe("angleymax=")) {
diff --git a/engines/phoenixvr/script.h b/engines/phoenixvr/script.h
index e84db0e1057..8764adb61c8 100644
--- a/engines/phoenixvr/script.h
+++ b/engines/phoenixvr/script.h
@@ -34,6 +34,9 @@ class SeekableReadStream;
 
 namespace PhoenixVR {
 namespace {
+inline float toRadian(float deg) {
+	return kPi * deg / 180;
+}
 inline float toAngle(int a) {
 	static const float angleToFloat = kPi / 4096.0f;
 	return angleToFloat * static_cast<float>(a);


Commit: 71f1ac9e212846937338e6e8b7ef0decb96a4d87
    https://github.com/scummvm/scummvm/commit/71f1ac9e212846937338e6e8b7ef0decb96a4d87
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-03-10T01:41:54Z

Commit Message:
PHOENIXVR: fabs/std::abs fixup

Changed paths:
    engines/phoenixvr/angle.h
    engines/phoenixvr/vr.cpp


diff --git a/engines/phoenixvr/angle.h b/engines/phoenixvr/angle.h
index 3d1bbef37ac..3bcd005d743 100644
--- a/engines/phoenixvr/angle.h
+++ b/engines/phoenixvr/angle.h
@@ -77,11 +77,11 @@ public:
 			return;
 
 		// out of bounds, find left or right
-		auto l0 = std::abs(_angle - _rangeMin);
-		auto l1 = std::abs(_angle - _rangeMin - range);
+		auto l0 = ABS(_angle - _rangeMin);
+		auto l1 = ABS(_angle - _rangeMin - range);
 		auto l = MIN(l0, l1);
-		auto r0 = std::abs(_rangeMax - _angle);
-		auto r1 = std::abs(range + _rangeMax - _angle);
+		auto r0 = ABS(_rangeMax - _angle);
+		auto r1 = ABS(range + _rangeMax - _angle);
 		auto r = MIN(r0, r1);
 		_angle = l < r ? _rangeMin : _rangeMax;
 	}
diff --git a/engines/phoenixvr/vr.cpp b/engines/phoenixvr/vr.cpp
index 1b19b75e580..2b3ea872c99 100644
--- a/engines/phoenixvr/vr.cpp
+++ b/engines/phoenixvr/vr.cpp
@@ -286,9 +286,9 @@ struct Cube {
 Cube toCube(float x, float y, float z) {
 	Cube cube = {};
 
-	float absX = fabs(x);
-	float absY = fabs(y);
-	float absZ = fabs(z);
+	float absX = ABS(x);
+	float absY = ABS(y);
+	float absZ = ABS(z);
 
 	bool isXPositive = x > 0;
 	bool isYPositive = y > 0;




More information about the Scummvm-git-logs mailing list