[Scummvm-git-logs] scummvm master -> cee3294e61302eb74c428b3700806a2a246bb5fd
neuromancer
noreply at scummvm.org
Sun Nov 9 10:12:41 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:
9d4feaa36e PRIVATE: correctly show diary pages for some releases
cee3294e61 PRIVATE: make list of places in the diary easily clickable
Commit: 9d4feaa36e074d0fbaecaa2ffc1f61643ba2efe6
https://github.com/scummvm/scummvm/commit/9d4feaa36e074d0fbaecaa2ffc1f61643ba2efe6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-09T11:12:31+01:00
Commit Message:
PRIVATE: correctly show diary pages for some releases
Changed paths:
engines/private/private.cpp
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 3fae4eace13..2890c90279b 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -970,6 +970,7 @@ void PrivateEngine::addMemory(const Common::String &path) {
DiaryPage diaryPage;
diaryPage.locationName = location;
+ diaryPage.locationID = -1;
uint locationIndex = 0;
for (auto &it : maps.locationList) {
@@ -977,12 +978,46 @@ void PrivateEngine::addMemory(const Common::String &path) {
locationIndex++;
Common::String currentLocation = it.substr(9);
+ if (it.size() <= 3) {
+ if (it == "k0") {
+ currentLocation = "mo";
+ } else if (it == "k1") {
+ currentLocation = "is";
+ } else if (it == "k2") {
+ currentLocation = "mw";
+ } else if (it == "k3") {
+ currentLocation = "cs";
+ } else if (it == "k4") {
+ currentLocation = "cw";
+ } else if (it == "k5") {
+ currentLocation = "ts";
+ } else if (it == "k6") {
+ currentLocation = "bo";
+ } else if (it == "k7") {
+ currentLocation = "gz";
+ } else if (it == "k8") {
+ currentLocation = "sg";
+ } else if (it == "k9") {
+ currentLocation = "da";
+ } else if (it == "k10") {
+ currentLocation = "dl";
+ } else if (it == "k11") {
+ currentLocation = "vn";
+ } else if (it == "k12") {
+ currentLocation = "po";
+ } else if (it == "k13") {
+ currentLocation = "dc";
+ } else
+ error("Unknown location symbol %s", it.c_str());
+ }
+
currentLocation.toLowercase();
if (sym->u.val && currentLocation == location) {
diaryPage.locationID = locationIndex;
break;
}
}
+ assert(diaryPage.locationID != -1);
diaryPage.memories.push_back(memory);
@@ -2030,7 +2065,7 @@ void PrivateEngine::loadInventory(uint32 x, const Common::Rect &r1, const Common
}
void PrivateEngine::loadMemories(const Common::Rect &rect, uint rightPageOffset, uint verticalOffset) {
- if (_currentDiaryPage < 0);
+ if (_currentDiaryPage < 0)
return;
Common::String s = Common::String::format("inface/diary/loctabs/drytab%d.bmp", _diaryPages[_currentDiaryPage].locationID);
Commit: cee3294e61302eb74c428b3700806a2a246bb5fd
https://github.com/scummvm/scummvm/commit/cee3294e61302eb74c428b3700806a2a246bb5fd
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-09T11:12:31+01:00
Commit Message:
PRIVATE: make list of places in the diary easily clickable
Changed paths:
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 2890c90279b..14d302b985a 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -610,12 +610,17 @@ bool PrivateEngine::inMask(Graphics::Surface *surf, Common::Point mousePos) {
return (surf->getPixel(mousePos.x, mousePos.y) != _transparentColor);
}
+bool PrivateEngine::inBox(const Common::Rect &box, Common::Point mousePos) {
+ return box.contains(mousePos);
+}
+
bool PrivateEngine::cursorMask(Common::Point mousePos) {
bool inside = false;
for (MaskList::const_iterator it = _masks.begin(); it != _masks.end(); ++it) {
const MaskInfo &m = *it;
- if (inMask(m.surf, mousePos)) {
+ bool inArea = m.useBoxCollision ? m.box.contains(mousePos) : inMask(m.surf, mousePos);
+ if (inArea) {
if (!m.cursor.empty()) { // TODO: check this
inside = true;
changeCursor(m.cursor);
@@ -854,7 +859,7 @@ bool PrivateEngine::selectLocation(const Common::Point &mousePos) {
for (auto &it : maps.locationList) {
const Private::Symbol *sym = maps.locations.getVal(it);
if (sym->u.val) {
- if (inMask(_locationMasks[i].surf, mousePos)) {
+ if (inBox(_locationMasks[i].box, mousePos)) {
bool diaryPageSet = false;
for (uint j = 0; j < _diaryPages.size(); j++) {
if (_diaryPages[j].locationID == totalLocations + 1) {
@@ -1896,11 +1901,10 @@ void PrivateEngine::drawScreenFrame(const byte *newPalette) {
g_system->copyRectToScreen(_mframeImage->getPixels(), _mframeImage->pitch, 0, 0, _screenW, _screenH);
}
-Graphics::Surface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
- debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d,%d)", __FUNCTION__, name.c_str(), x, y, drawn);
- Graphics::Surface *surf = new Graphics::Surface();
- surf->create(_screenW, _screenH, _pixelFormat);
- surf->fillRect(_screenRect, _transparentColor);
+void PrivateEngine::loadMaskAndInfo(MaskInfo *m, const Common::String &name, int x, int y, bool drawn) {
+ m->surf = new Graphics::Surface();
+ m->surf->create(_screenW, _screenH, _pixelFormat);
+ m->surf->fillRect(_screenRect, _transparentColor);
byte *palette;
bool isNewPalette;
Graphics::Surface *csurf = decodeImage(name, &palette, &isNewPalette);
@@ -1914,12 +1918,13 @@ Graphics::Surface *PrivateEngine::loadMask(const Common::String &name, int x, in
wdiff = y + csurf->w - _screenW;
Common::Rect crect(csurf->w - wdiff, csurf->h - hdiff);
- surf->copyRectToSurface(*csurf, x, y, crect);
+ m->surf->copyRectToSurface(*csurf, x, y, crect);
+ m->box = Common::Rect(x, y, x + csurf->w, y + csurf->h);
if (drawn) {
_compositeSurface->setPalette(palette, 0, 256);
_compositeSurface->setTransparentColor(_transparentColor);
- drawMask(surf);
+ drawMask(m->surf);
}
csurf->free();
@@ -1929,8 +1934,13 @@ Graphics::Surface *PrivateEngine::loadMask(const Common::String &name, int x, in
if (isNewPalette) {
free(palette);
}
+}
- return surf;
+Graphics::Surface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
+ debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d,%d)", __FUNCTION__, name.c_str(), x, y, drawn);
+ MaskInfo m;
+ loadMaskAndInfo(&m, name, x, y, drawn);
+ return m.surf;
}
void PrivateEngine::drawMask(Graphics::Surface *surf) {
@@ -2043,11 +2053,12 @@ void PrivateEngine::loadLocations(const Common::Rect &rect) {
Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), i);
MaskInfo m;
- m.surf = loadMask(s, rect.left + 120, rect.top + offset, true);
+ loadMaskAndInfo(&m, s, rect.left + 120, rect.top + offset, true);
m.cursor = g_private->getExitCursor();
m.nextSetting = getDiaryMiddleSetting();
m.flag1 = nullptr;
m.flag2 = nullptr;
+ m.useBoxCollision = true;
_masks.push_front(m);
_locationMasks.push_back(m);
}
diff --git a/engines/private/private.h b/engines/private/private.h
index e0b6007a782..666c5110a7e 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -88,9 +88,17 @@ typedef struct MaskInfo {
Symbol *flag2;
Common::String cursor;
Common::String inventoryItem;
+ bool useBoxCollision;
+ Common::Rect box;
+
+ MaskInfo() {
+ clear();
+ }
void clear() {
surf = nullptr;
+ useBoxCollision = false;
+ box = Common::Rect();
flag1 = nullptr;
flag2 = nullptr;
nextSetting.clear();
@@ -252,9 +260,11 @@ public:
// Rendering
Graphics::ManagedSurface *_compositeSurface;
Graphics::Surface *loadMask(const Common::String &, int, int, bool);
+ void loadMaskAndInfo(MaskInfo *m, const Common::String &name, int x, int y, bool drawn);
void drawMask(Graphics::Surface *);
void fillRect(uint32, Common::Rect);
bool inMask(Graphics::Surface *, Common::Point);
+ bool inBox(const Common::Rect &box, Common::Point mousePos);
uint32 _transparentColor;
Common::Rect _screenRect;
Common::String _framePath;
More information about the Scummvm-git-logs
mailing list