[Scummvm-git-logs] scummvm master -> 8d4e946df9642ccb3b4c8780c3bb56bbac6b585f
neuromancer
noreply at scummvm.org
Thu Oct 24 11:21:54 UTC 2024
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
05392e3a27 FREESCAPE: improved cga palette for eclipse
d880355a0e FREESCAPE: fixes for castle
0ad3732bfa FREESCAPE: better handling for group operations
223123ac56 FREESCAPE: better support for perspective matrix changes per game
8d4e946df9 FREESCAPE: fixed uninitialized value for borderExtra in driller
Commit: 05392e3a27c36f88fe7a8843a1386fab832ff248
https://github.com/scummvm/scummvm/commit/05392e3a27c36f88fe7a8843a1386fab832ff248
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-24T13:23:21+02:00
Commit Message:
FREESCAPE: improved cga palette for eclipse
Changed paths:
engines/freescape/games/eclipse/dos.cpp
diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
index 818c2b7b421..f9aefea0fa0 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -31,13 +31,20 @@ namespace Freescape {
extern byte kEGADefaultPalette[16][3];
byte kEclipseCGAPaletteRedGreen[4][3] = {
{0x00, 0x00, 0x00},
- {0x00, 0xff, 0xff},
- {0xff, 0x00, 0xff},
+ {0x55, 0xff, 0x55},
+ {0xff, 0x55, 0x55},
+ {0xff, 0xff, 0x55},
+};
+
+byte kEclipseCGAPalettePinkBlue[4][3] = {
+ {0x00, 0x00, 0x00},
+ {0x55, 0xff, 0xff},
+ {0xff, 0x55, 0xff},
{0xff, 0xff, 0xff},
};
static const CGAPaletteEntry rawCGAPaletteByArea[] {
- {1, (byte *)kEclipseCGAPaletteRedGreen},
+ {1, (byte *)kEclipseCGAPalettePinkBlue},
{2, (byte *)kEclipseCGAPaletteRedGreen},
{3, (byte *)kEclipseCGAPaletteRedGreen},
{4, (byte *)kEclipseCGAPaletteRedGreen},
Commit: d880355a0eda7bf517266a9e6bde3270a42e1a79
https://github.com/scummvm/scummvm/commit/d880355a0eda7bf517266a9e6bde3270a42e1a79
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-24T13:23:21+02:00
Commit Message:
FREESCAPE: fixes for castle
Changed paths:
engines/freescape/detection.cpp
engines/freescape/games/castle/castle.cpp
engines/freescape/games/castle/castle.h
engines/freescape/language/instruction.cpp
engines/freescape/objects/group.cpp
engines/freescape/objects/group.h
diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index c45cf31fe5a..b39dfdd30c1 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -1039,6 +1039,7 @@ static const DebugChannelDef debugFlagList[] = {
{Freescape::kFreescapeDebugParser, "parser", ""},
{Freescape::kFreescapeDebugCode, "code", ""},
{Freescape::kFreescapeDebugMedia, "media", ""},
+ {Freescape::kFreescapeDebugGroup, "group", ""},
DEBUG_CHANNEL_END
};
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index e0bbed1f0da..c33706b3048 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -47,6 +47,7 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
_playerHeightNumber = 1;
_playerHeightMaxNumber = 1;
+ _lastTenSeconds = -1;
_playerSteps.clear();
_playerSteps.push_back(15);
@@ -365,6 +366,11 @@ void CastleEngine::initGameState() {
setGameBit(k8bitGameBitTravelRock);
_gfx->_shakeOffset = Common::Point();
+
+ int seconds, minutes, hours;
+ getTimeFromCountdown(seconds, minutes, hours);
+ _lastMinute = minutes;
+ _lastTenSeconds = seconds / 10;
}
bool CastleEngine::checkIfGameEnded() {
@@ -1051,6 +1057,13 @@ void CastleEngine::updateTimeVariables() {
if (_spiritsMeterPosition >= _spiritsMeterMax)
_countdown = -1;
}
+
+ if (_lastTenSeconds != seconds / 10) {
+ //_gameStateVars[0x1e] += 1;
+ //_gameStateVars[0x1f] += 1;
+ _lastTenSeconds = seconds / 10;
+ executeLocalGlobalConditions(false, false, true);
+ }
}
void CastleEngine::borderScreen() {
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index f1f1b12dd8f..d7e2c9f5bc6 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -126,6 +126,8 @@ public:
int _spiritsMeterMax;
int _spiritsToKill;
+ int _lastTenSeconds;
+
private:
Common::SeekableReadStream *decryptFile(const Common::Path &filename);
void loadRiddles(Common::SeekableReadStream *file, int offset, int number);
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 3eb37de8076..acd469d9488 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -756,7 +756,8 @@ void FreescapeEngine::executeStartAnim(FCLInstruction &instruction) {
group = (Group *)obj->_partOfGroup;
}
debugC(1, kFreescapeDebugCode, "From group %d", group->getObjectID());
- group->_active = true;
+ if (!group->isDestroyed())
+ group->start();
}
diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index b94670ed65c..c317d5dec0e 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -91,7 +91,6 @@ void Group::linkObject(Object *obj) {
void Group::assemble(int index) {
GeometricObject *gobj = (GeometricObject *)_objects[index];
- //gobj->makeVisible();
Math::Vector3d position = _operations[_step]->position;
Math::Vector3d offset = _origins[index] - _origins[0];
/*if (index == 0)
@@ -108,7 +107,7 @@ void Group::assemble(int index) {
debugC(1, kFreescapeDebugGroup, "Group %d: Assembling object %d originally at %f, %f, %f", _objectID, gobj->getObjectID(), gobj->getOrigin().x(), gobj->getOrigin().y(), gobj->getOrigin().z());
gobj->offsetOrigin(position + offset);
- debugC(1, kFreescapeDebugGroup, "Group %d: Assembling object %d originally at %f, %f, %f", _objectID, gobj->getObjectID(), gobj->getOrigin().x(), gobj->getOrigin().y(), gobj->getOrigin().z());
+ debugC(1, kFreescapeDebugGroup, "Group %d: Assembling object %d moved to %f, %f, %f", _objectID, gobj->getObjectID(), gobj->getOrigin().x(), gobj->getOrigin().y(), gobj->getOrigin().z());
}
void Group::run() {
@@ -144,19 +143,22 @@ void Group::run() {
if (opcode & 0x20) {
for (uint32 i = 0; i < groupSize ; i++)
- _objects[i]->makeInvisible();
-
+ _objects[i]->destroy();
}
if (opcode & 0x40) {
for (uint32 i = 0; i < groupSize ; i++)
- _objects[i]->destroy();
+ _objects[i]->makeInvisible();
}
}
-
}
}
+void Group::start() {
+ makeVisible();
+ _active = true;
+}
+
void Group::reset() {
uint32 groupSize = _objects.size();
for (uint32 i = 0; i < groupSize ; i++) {
diff --git a/engines/freescape/objects/group.h b/engines/freescape/objects/group.h
index 8d6a7b5fe14..0dceaf6255d 100644
--- a/engines/freescape/objects/group.h
+++ b/engines/freescape/objects/group.h
@@ -51,6 +51,7 @@ public:
void run();
void run(int index);
void reset();
+ void start();
Common::Array<Object *> _objects;
Common::Array<Math::Vector3d> _origins;
Commit: 0ad3732bfa78e19ff313d9d17fef3c208f4e0386
https://github.com/scummvm/scummvm/commit/0ad3732bfa78e19ff313d9d17fef3c208f4e0386
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-24T13:23:21+02:00
Commit Message:
FREESCAPE: better handling for group operations
Changed paths:
engines/freescape/objects/group.cpp
diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index c317d5dec0e..8bd661db843 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -121,35 +121,41 @@ void Group::run() {
_active = true;
_step = -1;
//reset();
- } else if (opcode == 0x01) {
+ }
+
+ if (opcode & 0x01) {
debugC(1, kFreescapeDebugGroup, "Executing group condition %s", _operations[_step]->conditionSource.c_str());
g_freescape->executeCode(_operations[_step]->condition, false, true, false, false);
- } else if (opcode == 0x10) {
+ }
+
+ if (opcode & 0x10) {
uint32 groupSize = _objects.size();
for (uint32 i = 0; i < groupSize ; i++)
assemble(i);
_active = false;
_step++;
- } else if (opcode == 0x0) {
+ }
+
+ if (opcode == 0x0) {
debugC(1, kFreescapeDebugGroup, "Executing group assemble");
uint32 groupSize = _objects.size();
for (uint32 i = 0; i < groupSize ; i++)
assemble(i);
- } else {
+ }
+
+ if (opcode & 0x08) {
uint32 groupSize = _objects.size();
- if (opcode & 0x08) {
- for (uint32 i = 0; i < groupSize ; i++)
- _objects[i]->makeVisible();
+ for (uint32 i = 0; i < groupSize ; i++)
+ _objects[i]->makeVisible();
- if (opcode & 0x20) {
- for (uint32 i = 0; i < groupSize ; i++)
- _objects[i]->destroy();
- }
+ if (opcode & 0x20) {
+ for (uint32 i = 0; i < groupSize ; i++)
+ _objects[i]->destroy();
+ }
- if (opcode & 0x40) {
- for (uint32 i = 0; i < groupSize ; i++)
- _objects[i]->makeInvisible();
- }
+ if (opcode & 0x40) {
+ for (uint32 i = 0; i < groupSize ; i++)
+ _objects[i]->makeInvisible();
}
}
}
Commit: 223123ac563941cbb56b4af495b9d1250021dac2
https://github.com/scummvm/scummvm/commit/223123ac563941cbb56b4af495b9d1250021dac2
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-24T13:23:21+02:00
Commit Message:
FREESCAPE: better support for perspective matrix changes per game
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/games/castle/zx.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
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index bd209dcdb3f..5167e321931 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -144,8 +144,6 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
_lastFrame = 0;
_nearClipPlane = 2;
_farClipPlane = 8192 + 1802; // Added some extra distance to avoid flickering
- _yminValue = -0.625;
- _ymaxValue = 0.625;
// These depends on the specific game
_playerHeight = 0;
@@ -421,7 +419,8 @@ void FreescapeEngine::drawFrame() {
if (_currentArea->isOutside())
farClipPlane *= 100;
- _gfx->updateProjectionMatrix(90.0, _yminValue, _ymaxValue, _nearClipPlane, farClipPlane);
+ float aspectRatio = isCastle() ? 1.6 : 2.18;
+ _gfx->updateProjectionMatrix(75.0, aspectRatio, _nearClipPlane, farClipPlane);
_gfx->positionCamera(_position, _position + _cameraFront);
if (_underFireFrames > 0) {
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 29f3745db58..49c194afa99 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -483,8 +483,6 @@ public:
Math::Vector3d _scaleVector;
float _nearClipPlane;
float _farClipPlane;
- float _yminValue;
- float _ymaxValue;
// Text messages and Fonts
void insertTemporaryMessage(const Common::String message, int deadline);
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 89f55c26ed0..7a265d63ea5 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -29,9 +29,6 @@ namespace Freescape {
void CastleEngine::initZX() {
_viewArea = Common::Rect(64, 36, 256, 148);
- _yminValue = -1;
- _ymaxValue = 1;
-
_soundIndexShoot = 5;
_soundIndexCollide = -1;
_soundIndexFall = -1;
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index c92213f640f..ea14b7b6072 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -154,7 +154,7 @@ public:
*/
virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) = 0;
- virtual void updateProjectionMatrix(float fov, float yminValue, float ymaxValue, float nearClipPlane, float farClipPlane) = 0;
+ virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) = 0;
Math::Matrix4 getMvpMatrix() const { return _mvpMatrix; }
virtual Graphics::Surface *getScreenshot() = 0;
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index bf20c753748..15ed174e24c 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -199,18 +199,18 @@ void OpenGLRenderer::drawSkybox(Texture *texture, Math::Vector3d camera) {
glFlush();
}
-void OpenGLRenderer::updateProjectionMatrix(float fov, float yminValue, float ymaxValue, float nearClipPlane, float farClipPlane) {
+void OpenGLRenderer::updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- // Determining xmaxValue and ymaxValue still needs some work for matching the 3D view in freescape games
- /*float aspectRatio = _screenW / (float)_screenH;
- float xmaxValue = nearClipPlane * tan(Common::deg2rad(fov) / 2);
+ // Calculate the xmax and ymax values based on FOV and aspect ratio
+ float xmaxValue = nearClipPlane * tan(Math::deg2rad(fov) / 2);
float ymaxValue = xmaxValue / aspectRatio;
- // debug("max values: %f %f", xmaxValue, ymaxValue);
- glFrustum(xmaxValue, -xmaxValue, -ymaxValue, ymaxValue, nearClipPlane, farClipPlane);*/
- glFrustum(1.5, -1.5, yminValue, ymaxValue, nearClipPlane, farClipPlane);
+ // Corrected glFrustum call
+ glFrustum(-xmaxValue, xmaxValue, -ymaxValue, ymaxValue, nearClipPlane, farClipPlane);
+ glScalef(-1.0f, 1.0f, 1.0f);
+
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index c8f163282e7..bcfa171f010 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -88,7 +88,7 @@ public:
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 updateProjectionMatrix(float fov, float yminValue, float ymaxValue, float nearClipPlane, float farClipPlane) override;
+ virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) override;
virtual void useColor(uint8 r, uint8 g, uint8 b) override;
virtual void polygonOffset(bool enabled) override;
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index 6907bc2a28f..5c59865d17c 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -136,13 +136,10 @@ void OpenGLShaderRenderer::drawTexturedRect2D(const Common::Rect &screenRect, co
_bitmapShader->unbind();
}
-void OpenGLShaderRenderer::updateProjectionMatrix(float fov, float yminValue, float ymaxValue, float nearClipPlane, float farClipPlane) {
- // Determining xmaxValue and ymaxValue still needs some work for matching the 3D view in freescape games
- /*float aspectRatio = _screenW / (float)_screenH;
- float xmaxValue = nearClipPlane * tan(Common::deg2rad(fov) / 2);
+void OpenGLShaderRenderer::updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) {
+ float xmaxValue = nearClipPlane * tan(Math::deg2rad(fov) / 2);
float ymaxValue = xmaxValue / aspectRatio;
- _projectionMatrix = Math::makeFrustumMatrix(xmaxValue, -xmaxValue, -ymaxValue, ymaxValue, nearClipPlane, farClipPlane);*/
- _projectionMatrix = Math::makeFrustumMatrix(1.5, -1.5, yminValue, ymaxValue, nearClipPlane, farClipPlane);
+ _projectionMatrix = Math::makeFrustumMatrix(xmaxValue, -xmaxValue, -ymaxValue, ymaxValue, nearClipPlane, farClipPlane);
}
void OpenGLShaderRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) {
diff --git a/engines/freescape/gfx_opengl_shaders.h b/engines/freescape/gfx_opengl_shaders.h
index 9cff7bca06e..33211f60392 100644
--- a/engines/freescape/gfx_opengl_shaders.h
+++ b/engines/freescape/gfx_opengl_shaders.h
@@ -69,7 +69,7 @@ public:
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 updateProjectionMatrix(float fov, float yminValue, float ymaxValue, float nearClipPlane, float farClipPlane) override;
+ virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) override;
virtual void useColor(uint8 r, uint8 g, uint8 b) override;
virtual void polygonOffset(bool enabled) override;
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index 856ac2be840..205b1f20499 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -95,19 +95,17 @@ void TinyGLRenderer::drawTexturedRect2D(const Common::Rect &screenRect, const Co
tglBlit(((TinyGLTexture *)texture)->getBlitTexture(), transform);
}
-void TinyGLRenderer::updateProjectionMatrix(float fov, float yminValue, float ymaxValue, float nearClipPlane, float farClipPlane) {
+void TinyGLRenderer::updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) {
tglMatrixMode(TGL_PROJECTION);
tglLoadIdentity();
- // Determining xmaxValue and ymaxValue still needs some work for matching the 3D view in freescape games
- /*float aspectRatio = _screenW / (float)_screenH;
-
- float xmaxValue = nearClipPlane * tan(Common::deg2rad(fov) / 2);
+ float xmaxValue = nearClipPlane * tan(Math::deg2rad(fov) / 2);
float ymaxValue = xmaxValue / aspectRatio;
- // debug("max values: %f %f", xmaxValue, ymaxValue);
- tglFrustumf(xmaxValue, -xmaxValue, -ymaxValue, ymaxValue, nearClipPlane, farClipPlane);*/
- tglFrustumf(1.5, -1.5, yminValue, ymaxValue, nearClipPlane, farClipPlane);
+ // Corrected glFrustum call
+ tglFrustum(-xmaxValue, xmaxValue, -ymaxValue, ymaxValue, nearClipPlane, farClipPlane);
+ tglScalef(-1.0f, 1.0f, 1.0f);
+
tglMatrixMode(TGL_MODELVIEW);
tglLoadIdentity();
}
diff --git a/engines/freescape/gfx_tinygl.h b/engines/freescape/gfx_tinygl.h
index e2208644461..297d5505694 100644
--- a/engines/freescape/gfx_tinygl.h
+++ b/engines/freescape/gfx_tinygl.h
@@ -50,7 +50,7 @@ public:
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 updateProjectionMatrix(float fov, float yminValue, float ymaxValue, float nearClipPlane, float farClipPlane) override;
+ virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) override;
virtual void useColor(uint8 r, uint8 g, uint8 b) override;
virtual void polygonOffset(bool enabled) override;
Commit: 8d4e946df9642ccb3b4c8780c3bb56bbac6b585f
https://github.com/scummvm/scummvm/commit/8d4e946df9642ccb3b4c8780c3bb56bbac6b585f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-24T13:23:21+02:00
Commit Message:
FREESCAPE: fixed uninitialized value for borderExtra in driller
Changed paths:
engines/freescape/games/driller/driller.cpp
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 62baeaa9346..ede9f5cbf5a 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -107,6 +107,9 @@ DrillerEngine::DrillerEngine(OSystem *syst, const ADGameDescription *gd) : Frees
_soundIndexTimeout = 20;
_soundIndexForceEndGame = 20;
_soundIndexCrushed = 20;
+
+ _borderExtra = nullptr;
+ _borderExtraTexture = nullptr;
}
DrillerEngine::~DrillerEngine() {
More information about the Scummvm-git-logs
mailing list