[Scummvm-git-logs] scummvm master -> c4ff0c9044cbfadb26e62ff9dd16a1054984aff4
neuromancer
noreply at scummvm.org
Mon Apr 21 16:10:20 UTC 2025
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:
03de4bdc8b FREESCAPE: fix binary clock behavior during endgame for dark
c4ff0c9044 FREESCAPE: Added roll to driller and dark
Commit: 03de4bdc8b4029f3f2eb548f0baa37ac1627b2a5
https://github.com/scummvm/scummvm/commit/03de4bdc8b4029f3f2eb548f0baa37ac1627b2a5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-04-21T18:13:01+02:00
Commit Message:
FREESCAPE: fix binary clock behavior during endgame for dark
Changed paths:
engines/freescape/games/dark/dark.cpp
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 096b43a3e98..2a59dac4900 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -761,15 +761,18 @@ void DarkEngine::drawBinaryClock(Graphics::Surface *surface, int xPosition, int
if (_gameStateVars[kVariableDarkEnding] == 0)
number = (1 << 15) - 1;
- else
- number = 1 << (_ticks - _ticksFromEnd) / 15;
+ else {
+ int shift = (_ticks - _ticksFromEnd) / 15;
+ if (shift >= 15)
+ number = (1 << 15) - 1;
+ else
+ number = 1 << shift;
+ }
+
} else
return;
- int maxBits = isAtariST() || isAmiga() ? 14 : 15;
- /*if (number >= 1 << maxBits)
- number = (1 << maxBits) - 1;*/
-
+ int maxBits = 14;
int bits = 0;
while (bits <= maxBits) {
int y = 0;
Commit: c4ff0c9044cbfadb26e62ff9dd16a1054984aff4
https://github.com/scummvm/scummvm/commit/c4ff0c9044cbfadb26e62ff9dd16a1054984aff4
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-04-21T18:13:02+02:00
Commit Message:
FREESCAPE: Added roll to driller and dark
Changed paths:
NEWS.md
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/games/castle/castle.cpp
engines/freescape/games/dark/dark.cpp
engines/freescape/games/driller/driller.cpp
engines/freescape/games/eclipse/eclipse.cpp
engines/freescape/gfx.h
engines/freescape/gfx_opengl.cpp
engines/freescape/gfx_opengl.h
engines/freescape/gfx_opengl_shaders.cpp
engines/freescape/gfx_opengl_shaders.h
engines/freescape/gfx_tinygl.cpp
engines/freescape/gfx_tinygl.h
engines/freescape/movement.cpp
engines/freescape/ui.cpp
diff --git a/NEWS.md b/NEWS.md
index d4ff86203d2..42f8da370d0 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -9,6 +9,9 @@ For a more comprehensive changelog of the latest experimental code, see:
- Added support for The Adventures of Willy Beamish.
- Added support for Heart of China.
+ Freescape:
+ - Added roll rotation to Driller and Dark Side.
+
Hopkins:
- Fix crash using elevator to go to other floors.
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 704fd1409fb..3d4f3641519 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -105,6 +105,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
_cameraRight = Math::Vector3d(0, 0, 0);
_yaw = 0;
_pitch = 0;
+ _roll = 0;
_upVector = Math::Vector3d(0, 1, 0);
_mouseSensitivity = 0.25f;
_demoMode = false;
@@ -419,7 +420,7 @@ void FreescapeEngine::drawFrame() {
float aspectRatio = isCastle() ? 1.6 : 2.18;
_gfx->updateProjectionMatrix(75.0, aspectRatio, _nearClipPlane, farClipPlane);
- _gfx->positionCamera(_position, _position + _cameraFront);
+ _gfx->positionCamera(_position, _position + _cameraFront, _roll);
if (_underFireFrames > 0) {
int underFireColor = _currentArea->_underFireBackgroundColor;
@@ -488,7 +489,7 @@ void FreescapeEngine::resetInput() {
warpMouseToCrossair();
_eventManager->purgeMouseEvents();
_eventManager->purgeKeyboardEvents();
- rotate(0, 0);
+ rotate(0, 0, 0);
}
Common::Point FreescapeEngine::crossairPosToMousePos(const Common::Point &crossairPos) {
@@ -560,13 +561,19 @@ void FreescapeEngine::processInput() {
shoot();
break;
case kActionRotateUp:
- rotate(0, 5);
+ rotate(0, _angleRotations[_angleRotationIndex], 0);
break;
case kActionRotateDown:
- rotate(0, -5);
+ rotate(0, -_angleRotations[_angleRotationIndex], 0);
+ break;
+ case kActionRotateLeft:
+ rotate(-_angleRotations[_angleRotationIndex], 0, 0);
+ break;
+ case kActionRotateRight:
+ rotate(_angleRotations[_angleRotationIndex], 0, 0);
break;
case kActionTurnBack:
- rotate(180, 0);
+ rotate(180, 0, 0);
break;
case kActionToggleClipMode:
_noClipMode = !_noClipMode;
@@ -644,7 +651,7 @@ void FreescapeEngine::processInput() {
event.relMouse.y = -event.relMouse.y;
_eventManager->purgeMouseEvents();
- rotate(event.relMouse.x * _mouseSensitivity, event.relMouse.y * _mouseSensitivity);
+ rotate(event.relMouse.x * _mouseSensitivity, event.relMouse.y * _mouseSensitivity, 0);
}
break;
@@ -956,6 +963,7 @@ void FreescapeEngine::initGameState() {
_avoidRenderingFrames = 0;
_yaw = 0;
_pitch = 0;
+ _roll = 0;
_endGameKeyPressed = false;
_endGamePlayerEndArea = false;
@@ -971,9 +979,10 @@ void FreescapeEngine::initGameState() {
_exploredAreas.clear();
}
-void FreescapeEngine::rotate(float xoffset, float yoffset) {
+void FreescapeEngine::rotate(float xoffset, float yoffset, float zoffset) {
_yaw -= xoffset;
_pitch += yoffset;
+ _roll += zoffset;
// Make sure that when pitch is out of bounds, screen doesn't get flipped
if (_pitch > 360.0f)
@@ -986,6 +995,11 @@ void FreescapeEngine::rotate(float xoffset, float yoffset) {
if (_yaw < 0.0f)
_yaw += 360.0f;
+ if (_roll > 360.0f)
+ _roll -= 360.0f;
+ if (_roll < 0.0f)
+ _roll += 360.0f;
+
updateCamera();
}
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index d9c79a15aa7..dccea31bfd0 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -90,6 +90,8 @@ enum FreescapeAction {
// Driller
kActionDeployDrillingRig,
kActionCollectDrillingRig,
+ kActionRollLeft,
+ kActionRollRight,
// Total Eclipse
kActionRest,
// Castle
@@ -352,7 +354,7 @@ public:
int _maxShield;
int _maxEnergy;
- void rotate(float xoffset, float yoffset);
+ void rotate(float xoffset, float yoffset, float zoffset);
// Input state
float _lastFrame;
@@ -364,6 +366,7 @@ public:
// Euler Angles
float _yaw;
float _pitch;
+ int _roll;
int _angleRotationIndex;
Common::Array<float> _angleRotations;
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 15d1b623945..2fa06afd68d 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -452,11 +452,7 @@ void CastleEngine::endGame() {
void CastleEngine::pressedKey(const int keycode) {
// This code is duplicated in the DrillerEngine::pressedKey (except for the J case)
- if (keycode == kActionRotateLeft) {
- rotate(-_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == kActionRotateRight) {
- rotate(_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == Common::KEYCODE_s) {
+ if (keycode == Common::KEYCODE_s) {
// TODO: show score
} else if (keycode == kActionRunMode) {
if (_playerHeightNumber == 0) {
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 2a59dac4900..3609a2aa62a 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -219,6 +219,16 @@ void DarkEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoS
act->addDefaultInputMapping("w");
engineKeyMap->addAction(act);
+ act = new Common::Action("ROLL_LEFT", _("Roll left"));
+ act->setCustomEngineActionEvent(kActionRollLeft);
+ act->addDefaultInputMapping("n");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("ROLL_RIGHT", _("Roll right"));
+ act->setCustomEngineActionEvent(kActionRollRight);
+ act->addDefaultInputMapping("m");
+ engineKeyMap->addAction(act);
+
// I18N: STEP SIZE: Measures the size of one movement in the direction you are facing (1-250 standard distance units (SDUs))
act = new Common::Action("INCSTEPSIZE", _("Increase Step Size"));
act->setCustomEngineActionEvent(kActionIncreaseStepSize);
@@ -644,14 +654,14 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
void DarkEngine::pressedKey(const int keycode) {
// This code is duplicated in the DrillerEngine::pressedKey (except for the J case)
- if (keycode == kActionRotateLeft) {
- rotate(-_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == kActionRotateRight) {
- rotate(_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == kActionIncreaseStepSize) {
+ if (keycode == kActionIncreaseStepSize) {
increaseStepSize();
} else if (keycode == kActionDecreaseStepSize) {
decreaseStepSize();
+ } else if (keycode == kActionRollRight) {
+ rotate(0, 0, -_angleRotations[_angleRotationIndex]);
+ } else if (keycode == kActionRollLeft) {
+ rotate(0, 0, _angleRotations[_angleRotationIndex]);
} else if (keycode == kActionRiseOrFlyUp) {
rise();
} else if (keycode == kActionLowerOrFlyDown) {
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 3bd828e330f..2298be71f21 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -71,6 +71,7 @@ DrillerEngine::DrillerEngine(OSystem *syst, const ADGameDescription *gd) : Frees
_playerWidth = 12;
_playerDepth = 32;
_stepUpDistance = 64;
+ _roll = 0;
_initialTankEnergy = 48;
_initialTankShield = 50;
@@ -183,6 +184,16 @@ void DrillerEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *in
act->addDefaultInputMapping("r");
engineKeyMap->addAction(act);
+ act = new Common::Action("ROLL_LEFT", _("Roll left"));
+ act->setCustomEngineActionEvent(kActionRollLeft);
+ act->addDefaultInputMapping("n");
+ engineKeyMap->addAction(act);
+
+ act = new Common::Action("ROLL_RIGHT", _("Roll right"));
+ act->setCustomEngineActionEvent(kActionRollRight);
+ act->addDefaultInputMapping("m");
+ engineKeyMap->addAction(act);
+
act = new Common::Action("LOWER", _("Lower/Fly down"));
act->setCustomEngineActionEvent(kActionLowerOrFlyDown);
act->addDefaultInputMapping("JOY_Y");
@@ -491,11 +502,7 @@ Math::Vector3d getProjectionToPlane(const Math::Vector3d &vect, const Math::Vect
}
void DrillerEngine::pressedKey(const int keycode) {
- if (keycode == kActionRotateLeft) {
- rotate(-_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == kActionRotateRight) {
- rotate(_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == kActionIncreaseStepSize) {
+ if (keycode == kActionIncreaseStepSize) {
increaseStepSize();
} else if (keycode == kActionDecreaseStepSize) {
decreaseStepSize();
@@ -503,6 +510,10 @@ void DrillerEngine::pressedKey(const int keycode) {
rise();
} else if (keycode == kActionLowerOrFlyDown) {
lower();
+ } else if (keycode == kActionRollRight) {
+ rotate(0, 0, -_angleRotations[_angleRotationIndex]);
+ } else if (keycode == kActionRollLeft) {
+ rotate(0, 0, _angleRotations[_angleRotationIndex]);
} else if (keycode == kActionDeployDrillingRig) {
if (isDOS() && isDemo()) // No support for drilling here yet
return;
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index a7c77b2fca5..c47be2c9d92 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -458,11 +458,7 @@ void EclipseEngine::drawInfoMenu() {
}
void EclipseEngine::pressedKey(const int keycode) {
- if (keycode == kActionRotateLeft) {
- rotate(-_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == kActionRotateRight) {
- rotate(_angleRotations[_angleRotationIndex], 0);
- } else if (keycode == kActionChangeAngle) {
+ if (keycode == kActionChangeAngle) {
changeAngle();
} else if (keycode == kActionChangeStepSize) {
changeStepSize();
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index ca9d647a4b5..e3e632e7580 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -274,7 +274,7 @@ public:
* This also sets the viewport
*/
- virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) = 0;
+ virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float rollAngle = 0.0f) = 0;
virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) = 0;
Math::Matrix4 getMvpMatrix() const { return _mvpMatrix; }
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index fa584da2920..196fdf27357 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -215,11 +215,12 @@ void OpenGLRenderer::updateProjectionMatrix(float fov, float aspectRatio, float
glLoadIdentity();
}
-void OpenGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) {
+void OpenGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float rollAngle) {
Math::Vector3d up_vec(0, 1, 0);
Math::Matrix4 lookMatrix = Math::makeLookAtMatrix(pos, interest, up_vec);
glMultMatrixf(lookMatrix.getData());
+ glRotatef(rollAngle, 0.0f, 0.0f, 1.0f);
glTranslatef(-pos.x(), -pos.y(), -pos.z());
glTranslatef(_shakeOffset.x, _shakeOffset.y, 0);
}
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index 3cb03db32b9..8c80130fecf 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -69,7 +69,7 @@ public:
virtual void clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport = false) override;
virtual void setViewport(const Common::Rect &rect) override;
virtual Common::Point nativeResolution() override;
- virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) override;
+ virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float rollAngle = 0.0) override;
virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) override;
virtual void useColor(uint8 r, uint8 g, uint8 b) override;
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index 49c4ad77a06..a7530e2b989 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -203,7 +203,7 @@ void OpenGLShaderRenderer::updateProjectionMatrix(float fov, float aspectRatio,
_projectionMatrix = Math::makeFrustumMatrix(xmaxValue, -xmaxValue, -ymaxValue, ymaxValue, nearClipPlane, farClipPlane);
}
-void OpenGLShaderRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) {
+void OpenGLShaderRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float rollAngle) {
Math::Vector3d up_vec(0, 1, 0);
Math::Matrix4 lookMatrix = Math::makeLookAtMatrix(pos, interest, up_vec);
diff --git a/engines/freescape/gfx_opengl_shaders.h b/engines/freescape/gfx_opengl_shaders.h
index 948ec45a5a1..a748d4dac55 100644
--- a/engines/freescape/gfx_opengl_shaders.h
+++ b/engines/freescape/gfx_opengl_shaders.h
@@ -76,7 +76,7 @@ public:
virtual void clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport = false) override;
virtual void setViewport(const Common::Rect &rect) override;
virtual Common::Point nativeResolution() override;
- virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) override;
+ virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float rollAngle = 0.0f) override;
virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) override;
virtual void useColor(uint8 r, uint8 g, uint8 b) override;
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index 032f85953ab..0533aadeea8 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -162,11 +162,12 @@ void TinyGLRenderer::updateProjectionMatrix(float fov, float aspectRatio, float
tglLoadIdentity();
}
-void TinyGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) {
+void TinyGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float rollAngle) {
Math::Vector3d up_vec(0, 1, 0);
Math::Matrix4 lookMatrix = Math::makeLookAtMatrix(pos, interest, up_vec);
tglMultMatrixf(lookMatrix.getData());
+ tglRotatef(rollAngle, 0.0f, 0.0f, 1.0f);
tglTranslatef(-pos.x(), -pos.y(), -pos.z());
}
diff --git a/engines/freescape/gfx_tinygl.h b/engines/freescape/gfx_tinygl.h
index 0204dd275d7..a69027bc4f2 100644
--- a/engines/freescape/gfx_tinygl.h
+++ b/engines/freescape/gfx_tinygl.h
@@ -71,7 +71,7 @@ public:
virtual void init() override;
virtual void clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport = false) override;
virtual void setViewport(const Common::Rect &rect) override;
- virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) override;
+ virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float rollAngle = 0.0f) override;
virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) override;
virtual void useColor(uint8 r, uint8 g, uint8 b) override;
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index a5d0169f577..559ef97b8df 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -174,6 +174,8 @@ void FreescapeEngine::traverseEntrance(uint16 entranceID) {
_yaw = y - 90; // 180 to 270 maps to 90 to 0 (yaw should be 90 to 0)
else
_yaw = 360 + 90 - y; // 270 to 360 maps to 90 to 180 (yaw should be 90 to 180)
+
+ _roll = rotation.z();
}
debugC(1, kFreescapeDebugMove, "entrace position: %f %f %f", _position.x(), _position.y(), _position.z());
@@ -443,6 +445,9 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
if (fallen > _maxFallingDistance) {
_hasFallen = !_disableFalling;
+ _roll = -90;
+ _pitch = 0;
+ changePlayerHeight(0);
_avoidRenderingFrames = 60 * 3;
_endGameDelayTicks = 60 * 5;
if (isEclipse()) // No need for an variable index, since these are special types of sound
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index bc01512d581..5ca93d3b371 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -58,7 +58,7 @@ void FreescapeEngine::waitInLoop(int maxWait) {
_eventManager->purgeMouseEvents();
}
- rotate(event.relMouse.x * _mouseSensitivity, event.relMouse.y * _mouseSensitivity);
+ rotate(event.relMouse.x * _mouseSensitivity, event.relMouse.y * _mouseSensitivity, 0);
break;
case Common::EVENT_SCREEN_CHANGED:
More information about the Scummvm-git-logs
mailing list