[Scummvm-git-logs] scummvm master -> eeef19f371a1c99fc764e8ba42cf3355344d7278
neuromancer
noreply at scummvm.org
Wed Jul 29 19:24:51 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:
44d14646ec COLONY: fixed bug in widescreen handling when clicking mac menus
eeef19f371 COLONY: allow inverted y axis
Commit: 44d14646ec4604f28918eda1e94e1a339c682edc
https://github.com/scummvm/scummvm/commit/44d14646ec4604f28918eda1e94e1a339c682edc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-07-29T21:24:36+02:00
Commit Message:
COLONY: fixed bug in widescreen handling when clicking mac menus
Changed paths:
engines/colony/colony.cpp
engines/colony/colony.h
engines/colony/gfx.cpp
engines/colony/intro.cpp
engines/colony/metaengine.cpp
engines/colony/renderer.h
engines/colony/renderer_opengl.cpp
engines/colony/renderer_opengl_shaders.cpp
diff --git a/engines/colony/colony.cpp b/engines/colony/colony.cpp
index e20b86d44dc..7e085585e0c 100644
--- a/engines/colony/colony.cpp
+++ b/engines/colony/colony.cpp
@@ -304,23 +304,18 @@ ColonyEngine::~ColonyEngine() {
}
Common::Point ColonyEngine::eventMouseToLogical(const Common::Point &p) const {
- const int sysW = _system->getWidth();
- const int sysH = _system->getHeight();
- if (sysW <= 0 || sysH <= 0 || (sysW == _width && sysH == _height))
+ if (!_gfx)
return p;
- return Common::Point((int)((int64)p.x * _width / sysW),
- (int)((int64)p.y * _height / sysH));
+ return windowToCanvas(_gfx->screenViewport(), p, _width, _height);
}
void ColonyEngine::warpMouseLogical(int x, int y) {
- const int sysW = _system->getWidth();
- const int sysH = _system->getHeight();
- if (sysW <= 0 || sysH <= 0 || (sysW == _width && sysH == _height)) {
+ if (!_gfx) {
_system->warpMouse(x, y);
return;
}
- _system->warpMouse((int)((int64)x * sysW / _width),
- (int)((int64)y * sysH / _height));
+ const Common::Point p = canvasToWindow(_gfx->screenViewport(), Common::Point(x, y), _width, _height);
+ _system->warpMouse(p.x, p.y);
}
void ColonyEngine::pauseEngineIntern(bool pause) {
@@ -790,7 +785,10 @@ Common::Error ColonyEngine::run() {
}
if (_widescreen) {
- _width = _height * 16 / 9;
+ // (16/9)/(4/3) = 4/3: widen the canvas rather than stretch it. Holds
+ // for the Mac's square pixels and for DOS EGA's 0.73-wide ones, since
+ // there the shorter canvas cancels out. Both land on 853.
+ _width = _width * 4 / 3;
}
_gfx = createRenderer(_system, _width, _height);
diff --git a/engines/colony/colony.h b/engines/colony/colony.h
index 32a68aa8a37..eb37fa0086f 100644
--- a/engines/colony/colony.h
+++ b/engines/colony/colony.h
@@ -676,19 +676,10 @@ private:
int occupiedObjectAt(int xnew, int ynew, int x, int y, const Locate *pobject);
void interactWithObject(int objNum);
- // Convert a mouse coord delivered by the event manager into engine
- // logical coords. With kSupportsArbitraryResolutions declared, the
- // framework rewrites _currentState.gameWidth to the overlay (window)
- // pixel size in recalculateDisplayAreas() â so g_system->getWidth()
- // no longer matches our _width, and mouse events arrive in window
- // pixels. The engine's hit-test math (whichSprite, _screenR) is in
- // logical coords, so we have to scale back. Same pattern Freescape
- // uses in mousePosToCrossairPos (freescape.cpp:593-597).
+ // Mouse events (and warpMouse) speak window pixels, because we declare
+ // kSupportsArbitraryResolutions; the hit-test math (whichSprite, _screenR)
+ // is in logical coords. Convert both ways.
Common::Point eventMouseToLogical(const Common::Point &p) const;
- // Inverse of eventMouseToLogical: warp the mouse to a position
- // expressed in engine-logical coords. _system->warpMouse expects
- // virtual-screen coords, which with kSupportsArbitraryResolutions
- // is window pixels.
void warpMouseLogical(int x, int y);
// shoot.c: shooting and power management
diff --git a/engines/colony/gfx.cpp b/engines/colony/gfx.cpp
index 829d456b2ca..2525477cad5 100644
--- a/engines/colony/gfx.cpp
+++ b/engines/colony/gfx.cpp
@@ -28,6 +28,7 @@
#include "common/config-manager.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "common/util.h"
#include "engines/util.h"
#include "graphics/renderer.h"
@@ -39,6 +40,24 @@ namespace Colony {
// Forward declaration for the fixed-function OpenGL renderer factory.
Renderer *createOpenGLRenderer(OSystem *system, int width, int height);
+Common::Point windowToCanvas(const Common::Rect &viewport, const Common::Point &p, int canvasW, int canvasH) {
+ if (viewport.isEmpty() || canvasW <= 0 || canvasH <= 0)
+ return p;
+
+ const int x = CLIP<int>(p.x, viewport.left, viewport.right - 1) - viewport.left;
+ const int y = CLIP<int>(p.y, viewport.top, viewport.bottom - 1) - viewport.top;
+ return Common::Point((int)((int64)x * canvasW / viewport.width()),
+ (int)((int64)y * canvasH / viewport.height()));
+}
+
+Common::Point canvasToWindow(const Common::Rect &viewport, const Common::Point &p, int canvasW, int canvasH) {
+ if (viewport.isEmpty() || canvasW <= 0 || canvasH <= 0)
+ return p;
+
+ return Common::Point(viewport.left + (int)((int64)p.x * viewport.width() / canvasW),
+ viewport.top + (int)((int64)p.y * viewport.height() / canvasH));
+}
+
// Pick the renderer type. Honors --renderer=<code> on the command line /
// ConfMan key, restricted to what was compiled in.
//
diff --git a/engines/colony/intro.cpp b/engines/colony/intro.cpp
index e345cf30a5f..1a36afc849b 100644
--- a/engines/colony/intro.cpp
+++ b/engines/colony/intro.cpp
@@ -71,40 +71,30 @@ public:
if (processEvent(event))
continue;
- // MacDialog button rects are in _screen coordinates (engine
- // logical, e.g. 853Ã480). With kSupportsArbitraryResolutions
- // the framework rewrites g_system->getWidth/Height to window
- // pixel size, so event.mouse arrives in window pixels â
- // convert back to _screen coords before hit-testing.
- auto toLocal = [this](const Common::Point &p) -> Common::Point {
- const int sysW = g_system->getWidth();
- const int sysH = g_system->getHeight();
- if (sysW <= 0 || sysH <= 0 || (sysW == _screen->w && sysH == _screen->h))
- return p;
- return Common::Point((int)((int64)p.x * _screen->w / sysW),
- (int)((int64)p.y * _screen->h / sysH));
- };
+ // event.mouse is in window pixels; the button rects are in
+ // _screen coords.
+ const Common::Point m = windowToCanvas(gfx->screenViewport(), event.mouse,
+ _screen->w, _screen->h);
switch (event.type) {
case Common::EVENT_QUIT:
shouldQuitEngine = true;
shouldQuit = true;
break;
- case Common::EVENT_MOUSEMOVE: {
- const Common::Point p = toLocal(event.mouse);
- mouseMove(p.x, p.y);
+ case Common::EVENT_SCREEN_CHANGED:
+ // Nothing else refreshes the viewport while a dialog is up.
+ gfx->computeScreenViewport();
+ _needsRedraw = true;
break;
- }
- case Common::EVENT_LBUTTONDOWN: {
- const Common::Point p = toLocal(event.mouse);
- mouseClick(p.x, p.y);
+ case Common::EVENT_MOUSEMOVE:
+ mouseMove(m.x, m.y);
break;
- }
- case Common::EVENT_LBUTTONUP: {
- const Common::Point p = toLocal(event.mouse);
- shouldQuit = mouseRaise(p.x, p.y);
+ case Common::EVENT_LBUTTONDOWN:
+ mouseClick(m.x, m.y);
+ break;
+ case Common::EVENT_LBUTTONUP:
+ shouldQuit = mouseRaise(m.x, m.y);
break;
- }
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_ESCAPE) {
_pressedButton = -1;
diff --git a/engines/colony/metaengine.cpp b/engines/colony/metaengine.cpp
index 717450467c6..ae50b690f84 100644
--- a/engines/colony/metaengine.cpp
+++ b/engines/colony/metaengine.cpp
@@ -45,7 +45,7 @@ const ADExtraGuiOptionsMap optionsList[] = {
_s("Widescreen mod"),
_s("Enable widescreen rendering in fullscreen mode."),
"widescreen_mod",
- false,
+ true,
0,
0
}
diff --git a/engines/colony/renderer.h b/engines/colony/renderer.h
index 3b192c436a3..179c890a62b 100644
--- a/engines/colony/renderer.h
+++ b/engines/colony/renderer.h
@@ -72,6 +72,10 @@ public:
virtual void setDepthRange(float nearVal, float farVal) {}
virtual void computeScreenViewport() = 0;
+ // Window-pixel rect the logical canvas is drawn into: the whole window
+ // with the widescreen mod on, pillar/letterboxed otherwise.
+ const Common::Rect &screenViewport() const { return _screenViewport; }
+
// Overlay a RGBA software surface onto the GL framebuffer (for Mac menu bar).
virtual void drawSurface(const Graphics::Surface *surf, int x, int y) {}
virtual Graphics::Surface *getScreenshot() { return nullptr; }
@@ -80,8 +84,18 @@ public:
// Convenience color accessors
uint32 white() const { return 255; }
uint32 black() const { return 0; }
+
+protected:
+ Common::Rect _screenViewport;
};
+// Window pixels (what the event manager delivers) to logical canvas coords and
+// back, through screenViewport(). Scaling by the plain window/canvas ratio
+// instead lands every hit test half a black bar off. Points inside the bars
+// clamp to the nearest canvas edge.
+Common::Point windowToCanvas(const Common::Rect &viewport, const Common::Point &p, int canvasW, int canvasH);
+Common::Point canvasToWindow(const Common::Rect &viewport, const Common::Point &p, int canvasW, int canvasH);
+
// Factory function (follows Freescape pattern: picks best available renderer)
Renderer *createRenderer(OSystem *system, int width, int height);
diff --git a/engines/colony/renderer_opengl.cpp b/engines/colony/renderer_opengl.cpp
index e93f1503c36..c4818ac0db7 100644
--- a/engines/colony/renderer_opengl.cpp
+++ b/engines/colony/renderer_opengl.cpp
@@ -118,7 +118,6 @@ private:
const byte *_stippleData = nullptr; // GL_POLYGON_STIPPLE pattern (128 bytes), null = disabled
uint32 _stippleFgColor = 0;
uint32 _stippleBgColor = 0;
- Common::Rect _screenViewport;
};
OpenGLRenderer::OpenGLRenderer(OSystem *system, int width, int height) : _system(system), _width(width), _height(height) {
diff --git a/engines/colony/renderer_opengl_shaders.cpp b/engines/colony/renderer_opengl_shaders.cpp
index 9315a5c8f9b..f05bb02c14d 100644
--- a/engines/colony/renderer_opengl_shaders.cpp
+++ b/engines/colony/renderer_opengl_shaders.cpp
@@ -119,7 +119,6 @@ private:
int _width = 0;
int _height = 0;
byte _palette[256 * 3] = {};
- Common::Rect _screenViewport;
OpenGL::Shader *_solidShader = nullptr;
OpenGL::Shader *_bitmapShader = nullptr;
Commit: eeef19f371a1c99fc764e8ba42cf3355344d7278
https://github.com/scummvm/scummvm/commit/eeef19f371a1c99fc764e8ba42cf3355344d7278
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-07-29T21:24:36+02:00
Commit Message:
COLONY: allow inverted y axis
Changed paths:
engines/colony/colony.cpp
engines/colony/colony.h
engines/colony/detection.cpp
engines/colony/detection.h
engines/colony/metaengine.cpp
diff --git a/engines/colony/colony.cpp b/engines/colony/colony.cpp
index 7e085585e0c..c60f436a047 100644
--- a/engines/colony/colony.cpp
+++ b/engines/colony/colony.cpp
@@ -148,6 +148,7 @@ ColonyEngine::ColonyEngine(OSystem *syst, const ADGameDescription *gd) : Engine(
_unlocked = false;
_weapons = 0;
_widescreen = ConfMan.getBool("widescreen_mod");
+ _invertY = ConfMan.getBool("invert_y");
// Render mode: EGA (DOS wireframe default) or Macintosh (filled polygons)
if (!ConfMan.hasKey("render_mode") || ConfMan.get("render_mode").empty())
@@ -333,6 +334,11 @@ void ColonyEngine::pauseEngineIntern(bool pause) {
_frameLimiter->pause(pause);
}
+void ColonyEngine::applyGameSettings() {
+ // Not _widescreen: the canvas size is fixed at renderer creation.
+ _invertY = ConfMan.getBool("invert_y");
+}
+
void ColonyEngine::loadMacColors() {
_hasMacColors = false;
Common::SeekableReadStream *file = nullptr;
@@ -1084,7 +1090,7 @@ Common::Error ColonyEngine::run() {
// relMouse stays in window-pixel deltas regardless of
// resolution mode â keep raw for mouselook feel.
mouseDX += event.relMouse.x;
- mouseDY += event.relMouse.y;
+ mouseDY += _invertY ? -event.relMouse.y : event.relMouse.y;
mouseMoved = true;
}
}
diff --git a/engines/colony/colony.h b/engines/colony/colony.h
index eb37fa0086f..912ef8baf0f 100644
--- a/engines/colony/colony.h
+++ b/engines/colony/colony.h
@@ -448,6 +448,7 @@ public:
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
void pauseEngineIntern(bool pause) override;
+ void applyGameSettings() override;
Common::Platform getPlatform() const { return _gameDescription->platform; }
bool isSoundEnabled() const { return _soundOn; }
const Graphics::Surface *getSavedScreen() const { return _savedScreen; }
@@ -516,6 +517,7 @@ private:
int _width, _height;
float _mouseSensitivity;
bool _mouseLocked;
+ bool _invertY;
bool _soundOn = true;
bool _showDashBoard;
bool _crosshair;
diff --git a/engines/colony/detection.cpp b/engines/colony/detection.cpp
index 9accb58418c..3840776d953 100644
--- a/engines/colony/detection.cpp
+++ b/engines/colony/detection.cpp
@@ -76,7 +76,7 @@ const ADGameDescription gameDescriptions[] = {
class ColonyMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDescription> {
public:
ColonyMetaEngineDetection() : AdvancedMetaEngineDetection(Colony::gameDescriptions, Colony::colonyGames) {
- _guiOptions = GUIO1(GAMEOPTION_WIDESCREEN);
+ _guiOptions = GUIO2(GAMEOPTION_WIDESCREEN, GAMEOPTION_INVERT_Y);
}
const char *getName() const override {
diff --git a/engines/colony/detection.h b/engines/colony/detection.h
index 144d843dadd..041e54bef0b 100644
--- a/engines/colony/detection.h
+++ b/engines/colony/detection.h
@@ -39,6 +39,7 @@ enum ColonyDebugChannels {
extern const ADGameDescription gameDescriptions[];
#define GAMEOPTION_WIDESCREEN GUIO_GAMEOPTIONS1
+#define GAMEOPTION_INVERT_Y GUIO_GAMEOPTIONS2
} // End of namespace Colony
diff --git a/engines/colony/metaengine.cpp b/engines/colony/metaengine.cpp
index ae50b690f84..bc815b7e67b 100644
--- a/engines/colony/metaengine.cpp
+++ b/engines/colony/metaengine.cpp
@@ -50,6 +50,17 @@ const ADExtraGuiOptionsMap optionsList[] = {
0
}
},
+ {
+ GAMEOPTION_INVERT_Y,
+ {
+ _s("Invert Y-axis on mouse"),
+ _s("Use alternative camera controls"),
+ "invert_y",
+ false,
+ 0,
+ 0
+ }
+ },
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
More information about the Scummvm-git-logs
mailing list