[Scummvm-git-logs] scummvm master -> 398823e9d8476f8377473cbb461ec394a3c0498e
whoozle
noreply at scummvm.org
Thu Mar 12 22:19:35 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
398823e9d8 PHOENIXVR: implement fade
Commit: 398823e9d8476f8377473cbb461ec394a3c0498e
https://github.com/scummvm/scummvm/commit/398823e9d8476f8377473cbb461ec394a3c0498e
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-03-12T22:19:20Z
Commit Message:
PHOENIXVR: implement fade
Changed paths:
engines/phoenixvr/commands.h
engines/phoenixvr/phoenixvr.cpp
engines/phoenixvr/phoenixvr.h
diff --git a/engines/phoenixvr/commands.h b/engines/phoenixvr/commands.h
index 954c386e4f8..4c79268aca6 100644
--- a/engines/phoenixvr/commands.h
+++ b/engines/phoenixvr/commands.h
@@ -1089,11 +1089,11 @@ struct StopSound3D : public Script::Command {
};
struct Fade : public Script::Command {
- int arg0, arg1, arg2;
+ int start, stop, speed;
- Fade(int a0, int a1, int a2) : arg0(a0), arg1(a1), arg2(a2) {}
+ Fade(int a0, int a1, int a2) : start(a0), stop(a1), speed(a2) {}
void exec(Script::ExecutionContext &ctx) const override {
- warning("fade %d %d %d", arg0, arg1, arg2);
+ g_engine->fade(start, stop, speed);
}
};
diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index a3e83eaf708..1ed942c04b9 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -267,6 +267,62 @@ void PhoenixVREngine::interpolateAngle(float x, float y, float speed, float zoom
setZoom(zoom);
}
+void PhoenixVREngine::renderFade(int color) {
+ auto &format = _screen->format;
+ for (int y = 0; y != _screen->h; ++y) {
+ for (int x = 0; x != _screen->w; ++x) {
+ uint8 r, g, b;
+ format.colorToRGB(_screen->getPixel(x, y), r, g, b);
+ int ri = CLIP(static_cast<int>(r) + color, 0, 255);
+ int gi = CLIP(static_cast<int>(g) + color, 0, 255);
+ int bi = CLIP(static_cast<int>(b) + color, 0, 255);
+ _screen->setPixel(x, y, format.RGBToColor(ri, gi, bi));
+ }
+ }
+}
+
+void PhoenixVREngine::fade(int start, int stop, int speed) {
+ debug("fade %d %d speed: %d", start, stop, speed);
+
+ if (start == stop)
+ return;
+
+ bool waiting = true;
+ float pos = start, dt = 0;
+ bool increment = start < stop;
+ if (!increment)
+ speed = -speed;
+
+ float speedMs = speed * 1000.0f / 16;
+
+ while (!shouldQuit() && waiting && (increment ? pos < stop : pos > stop)) {
+ 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;
+ }
+ }
+ renderVR(dt);
+ renderFade(pos);
+
+ pos += 1 + dt * speedMs;
+
+ // Delay for a bit. All events loops should have a delay
+ // to prevent the system being unduly loaded
+ _frameLimiter.delayBeforeSwap();
+ _screen->update();
+ dt = _frameLimiter.startFrame() / 1000.0f;
+ }
+}
+
void PhoenixVREngine::until(const Common::String &var, int value) {
debug("until %s %d", var.c_str(), value);
unsigned frameDuration = 0;
diff --git a/engines/phoenixvr/phoenixvr.h b/engines/phoenixvr/phoenixvr.h
index 1ba13fa29c0..6aa39a2a222 100644
--- a/engines/phoenixvr/phoenixvr.h
+++ b/engines/phoenixvr/phoenixvr.h
@@ -147,6 +147,7 @@ public:
_fov = fov;
}
void interpolateAngle(float x, float y, float speed, float zoom);
+ void fade(int start, int stop, int speed);
void setXMax(float max) {
static const float baseX = -kPi2;
@@ -212,6 +213,7 @@ private:
void loadNextScript();
void renderVR(float dt);
void renderTimer();
+ void renderFade(int color);
private:
bool _hasFocus = true;
More information about the Scummvm-git-logs
mailing list