[Scummvm-git-logs] scummvm master -> 98c929168253c422ee2fc925aeb5223f34c9eb8c
fracturehill
noreply at scummvm.org
Wed Jan 31 21:56:16 UTC 2024
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2eda922e73 NANCY: Clip Autotext contents of PeepholePuzzle
740d69cb67 DEVTOOLS: Fix entry in nancy7 data
de55da6ae4 NANCY: Correctly load nancy8 LOAD chunk
98c9291682 NANCY: Rename incorrectly named parameter
Commit: 2eda922e7363e894253dc2c5f454dd3ccb9a9d4b
https://github.com/scummvm/scummvm/commit/2eda922e7363e894253dc2c5f454dd3ccb9a9d4b
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-01-31T22:55:57+01:00
Commit Message:
NANCY: Clip Autotext contents of PeepholePuzzle
When using an Autotext surface as a source, PeepholePuzzle
will no longer scroll past the bottom of its text contents.
This was only implemented in nancy7, but I'm leaving
it enabled in nancy6 as well, since it's a nice QOL feature.
Changed paths:
engines/nancy/action/autotext.cpp
engines/nancy/action/puzzle/peepholepuzzle.cpp
engines/nancy/graphics.h
engines/nancy/resource.cpp
diff --git a/engines/nancy/action/autotext.cpp b/engines/nancy/action/autotext.cpp
index 40b276a6f72..bacf644ab3a 100644
--- a/engines/nancy/action/autotext.cpp
+++ b/engines/nancy/action/autotext.cpp
@@ -130,6 +130,7 @@ void Autotext::execute() {
uint surfHeight = _textLines[0].size() / 144 * _surfWidth;
surfHeight = MAX<uint>(surfHeight, _surfHeight + 20);
Graphics::ManagedSurface &surf = g_nancy->_graphicsManager->getAutotextSurface(_surfaceID);
+ Common::Rect &surfBounds = g_nancy->_graphicsManager->getAutotextSurfaceBounds(_surfaceID);
surf.create(_surfWidth + 1, surfHeight, g_nancy->_graphicsManager->getInputPixelFormat());
if (_transparency) {
surf.clear(g_nancy->_graphicsManager->getTransColor());
@@ -156,6 +157,7 @@ void Autotext::execute() {
auto *tbox = GetEngineData(TBOX);
drawAllText(textBounds, tbox->leftOffset - textBounds.left, _fontID, _fontID);
+ surfBounds = Common::Rect(_fullSurface.w, _drawnTextHeight);
}
_isDone = true;
diff --git a/engines/nancy/action/puzzle/peepholepuzzle.cpp b/engines/nancy/action/puzzle/peepholepuzzle.cpp
index 746de7bc7a4..864d991674c 100644
--- a/engines/nancy/action/puzzle/peepholepuzzle.cpp
+++ b/engines/nancy/action/puzzle/peepholepuzzle.cpp
@@ -38,7 +38,13 @@ void PeepholePuzzle::init() {
_drawSurface.create(screenBounds.width(), screenBounds.height(), g_nancy->_graphicsManager->getInputPixelFormat());
moveTo(screenBounds);
- g_nancy->_resource->loadImage(_innerImageName, _innerImage);
+ Common::Rect innerImageContentBounds;
+ g_nancy->_resource->loadImage(_innerImageName, _innerImage, Common::String(), &innerImageContentBounds);
+ if (!innerImageContentBounds.isEmpty()) {
+ // When using Autotext, make sure scrolling stops with the end of the text content.
+ // This was implemented in nancy7, but it's better to have it on for nancy6 as well.
+ _innerBounds.clip(innerImageContentBounds);
+ }
if (_buttonsImageName.empty()) {
// Empty image name for buttons, use other image as source
@@ -176,7 +182,7 @@ void PeepholePuzzle::handleInput(NancyInput &input) {
// Down
_currentSrc.translate(0, pixelsToMove);
if (_currentSrc.bottom > _innerBounds.bottom) {
- _currentSrc.translate(0, _innerBounds.top - _currentSrc.top);
+ _currentSrc.translate(0, _innerBounds.bottom - _currentSrc.bottom);
}
break;
case 2 :
@@ -255,7 +261,32 @@ void PeepholePuzzle::checkButtons() {
} else {
_disabledButtons[i] = true;
}
- }
+ }
+
+ // Ensure that contents that do not overflow can't be scrolled
+ if (_innerBounds.height() <= _dest.height()) {
+ _disabledButtons[0] = _disabledButtons[1] = true;
+
+ if (!_buttonDisabledSrcs[0].isEmpty()) {
+ _drawSurface.blitFrom(_buttonsImage, _buttonDisabledSrcs[0], _buttonDests[0]);
+ }
+
+ if (!_buttonDisabledSrcs[1].isEmpty()) {
+ _drawSurface.blitFrom(_buttonsImage, _buttonDisabledSrcs[1], _buttonDests[1]);
+ }
+ }
+
+ if (_innerBounds.width() <= _dest.width()) {
+ _disabledButtons[2] = _disabledButtons[3] = true;
+
+ if (!_buttonDisabledSrcs[2].isEmpty()) {
+ _drawSurface.blitFrom(_buttonsImage, _buttonDisabledSrcs[2], _buttonDests[2]);
+ }
+
+ if (!_buttonDisabledSrcs[3].isEmpty()) {
+ _drawSurface.blitFrom(_buttonsImage, _buttonDisabledSrcs[3], _buttonDests[3]);
+ }
+ }
}
} // End of namespace Action
diff --git a/engines/nancy/graphics.h b/engines/nancy/graphics.h
index 3b80a8de9af..0a263c1333b 100644
--- a/engines/nancy/graphics.h
+++ b/engines/nancy/graphics.h
@@ -57,6 +57,7 @@ public:
uint32 getTransColor() { return _transColor; }
Graphics::ManagedSurface &getAutotextSurface(uint16 id) { return _autotextSurfaces.getOrCreateVal(id); }
+ Common::Rect &getAutotextSurfaceBounds(uint16 id) { return _autotextSurfaceBounds.getOrCreateVal(id); }
void grabViewportObjects(Common::Array<RenderObject *> &inArray);
void screenshotScreen(Graphics::ManagedSurface &inSurf);
@@ -91,6 +92,7 @@ private:
Common::List<Common::Rect> _dirtyRects;
Common::HashMap<uint16, Graphics::ManagedSurface> _autotextSurfaces;
+ Common::HashMap<uint16, Common::Rect> _autotextSurfaceBounds;
uint32 _transColor = 0;
diff --git a/engines/nancy/resource.cpp b/engines/nancy/resource.cpp
index e9dd82fc072..69e53a6608d 100644
--- a/engines/nancy/resource.cpp
+++ b/engines/nancy/resource.cpp
@@ -51,6 +51,13 @@ bool ResourceManager::loadImage(const Common::Path &name, Graphics::ManagedSurfa
if (surfID >= 0) {
surf.copyFrom(g_nancy->_graphicsManager->getAutotextSurface(surfID));
+ if (outSrc) {
+ // Slightly hacky, but we pass the size of the drawn text using the outSrc parameter;
+ // value is only guaranteed to be valid for an active surface.
+ // This is used for PeepholePuzzle scrolling.
+ *outSrc = g_nancy->_graphicsManager->getAutotextSurfaceBounds(surfID);
+ }
+
return true;
}
}
Commit: 740d69cb67b53edf93c19e250471eddb1919b8c2
https://github.com/scummvm/scummvm/commit/740d69cb67b53edf93c19e250471eddb1919b8c2
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-01-31T22:55:57+01:00
Commit Message:
DEVTOOLS: Fix entry in nancy7 data
Changed paths:
devtools/create_nancy/nancy7_data.h
diff --git a/devtools/create_nancy/nancy7_data.h b/devtools/create_nancy/nancy7_data.h
index 175e9d59a0f..9c691629e66 100644
--- a/devtools/create_nancy/nancy7_data.h
+++ b/devtools/create_nancy/nancy7_data.h
@@ -70,7 +70,7 @@ const Common::Array<Common::Array<ConditionalDialogue>> _nancy7ConditionalDialog
{ { kEv, 124, false }, { kEv, 204, false }, { kIn, 23, true } } },
{ 0, 1065, "NES65",
{ { kEv, 323, true }, { kEv, 112, false } } },
- { 0, 1063, "NES63",
+ { 0, 1066, "NES66",
{ { kEv, 456, true }, { kEv, 102, true }, { kEv, 119, false } } },
{ 0, 1067, "NES67",
{ { kEv, 302, true }, { kEv, 102, true }, { kEv, 121, false } } },
Commit: de55da6ae440f9102f0a3d854faf25a58f635502
https://github.com/scummvm/scummvm/commit/de55da6ae440f9102f0a3d854faf25a58f635502
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-01-31T22:55:57+01:00
Commit Message:
NANCY: Correctly load nancy8 LOAD chunk
In nancy8, the save/load menu got a rewrite, and its data
is incompatible with the older version. This commit
introduces a new struct type for the new LOAD data,
and makes sure it is loaded. This allows nancy8 to boot.
Changed paths:
engines/nancy/enginedata.cpp
engines/nancy/enginedata.h
engines/nancy/nancy.cpp
diff --git a/engines/nancy/enginedata.cpp b/engines/nancy/enginedata.cpp
index f5a6582d981..21c3d212ee5 100644
--- a/engines/nancy/enginedata.cpp
+++ b/engines/nancy/enginedata.cpp
@@ -494,6 +494,34 @@ LOAD::LOAD(Common::SeekableReadStream *chunkStream) :
}
}
+LOAD_v2::LOAD_v2(Common::SeekableReadStream *chunkStream) :
+ EngineData(chunkStream) {
+ readFilename(*chunkStream, _firstPageimageName);
+ readFilename(*chunkStream, _otherPageimageName);
+ readFilename(*chunkStream, _buttonsImageName);
+
+ readRectArray(*chunkStream, _unpressedButtonSrcs, 5);
+ readRectArray(*chunkStream, _pressedButtonSrcs, 5);
+ readRectArray(*chunkStream, _highlightedButtonSrcs, 5);
+ readRectArray(*chunkStream, _disabledButtonSrcs, 5);
+
+ readRectArray(*chunkStream, _buttonDests, 5);
+ readRectArray(*chunkStream, _textboxBounds, 10);
+
+ chunkStream->skip(25); // prefixes and suffixes for filenames
+
+ _mainFontID = chunkStream->readSint16LE();
+ _highlightFontID = chunkStream->readSint16LE();
+ _fontXOffset = chunkStream->readSint16LE();
+ _fontYOffset = chunkStream->readSint16LE();
+
+ chunkStream->skip(16); // src rect for dash in font
+ _blinkingTimeDelay = chunkStream->readUint16LE();
+
+ readFilename(*chunkStream, _gameSavedPopup);
+ readFilename(*chunkStream, _emptySaveText);
+}
+
SDLG::SDLG(Common::SeekableReadStream *chunkStream) : EngineData(chunkStream) {
while (chunkStream->pos() < chunkStream->size()) {
dialogs.push_back(Dialog(chunkStream));
diff --git a/engines/nancy/enginedata.h b/engines/nancy/enginedata.h
index 099b277bf77..57f7a203c0e 100644
--- a/engines/nancy/enginedata.h
+++ b/engines/nancy/enginedata.h
@@ -255,7 +255,7 @@ struct SET : public EngineData {
Common::Array<SoundDescription> _sounds;
};
-// Contains data for the Save/Load screen
+// Contains data for the Save/Load screen. Used up to nancy7
struct LOAD : public EngineData {
LOAD(Common::SeekableReadStream *chunkStream);
@@ -297,6 +297,33 @@ struct LOAD : public EngineData {
// Common::Rect _gameSavedBounds
};
+// Contains data for the new Save/Load screen. Used in nancy8 and up
+struct LOAD_v2 : public EngineData {
+ LOAD_v2(Common::SeekableReadStream *chunkStream);
+
+ Common::Path _firstPageimageName;
+ Common::Path _otherPageimageName;
+ Common::Path _buttonsImageName;
+
+ Common::Array<Common::Rect> _unpressedButtonSrcs;
+ Common::Array<Common::Rect> _pressedButtonSrcs;
+ Common::Array<Common::Rect> _highlightedButtonSrcs;
+ Common::Array<Common::Rect> _disabledButtonSrcs;
+
+ Common::Array<Common::Rect> _buttonDests;
+ Common::Array<Common::Rect> _textboxBounds;
+
+ int16 _mainFontID;
+ int16 _highlightFontID;
+ int16 _fontXOffset;
+ int16 _fontYOffset;
+
+ uint16 _blinkingTimeDelay;
+
+ Common::Path _gameSavedPopup;
+ Common::String _emptySaveText;
+};
+
// Contains data for the prompt that appears when exiting the game
// without saving first. Introduced in nancy3.
struct SDLG : public EngineData {
diff --git a/engines/nancy/nancy.cpp b/engines/nancy/nancy.cpp
index ac936426ee6..30514192d1e 100644
--- a/engines/nancy/nancy.cpp
+++ b/engines/nancy/nancy.cpp
@@ -441,7 +441,6 @@ void NancyEngine::bootGameEngine() {
LOAD_BOOT(CRED)
LOAD_BOOT(MENU)
LOAD_BOOT(SET)
- LOAD_BOOT(LOAD)
LOAD_BOOT(SDLG)
LOAD_BOOT(MAP)
LOAD_BOOT(HINT)
@@ -452,6 +451,13 @@ void NancyEngine::bootGameEngine() {
LOAD_BOOT(RCLB)
LOAD_BOOT(TABL)
+ if (g_nancy->getGameType() <= kGameTypeNancy7) {
+ LOAD_BOOT(LOAD)
+ } else {
+ // nancy8 has a completely new save/load screen
+ LOAD_BOOT_L(LOAD_v2, "LOAD")
+ }
+
_cursorManager->init(iff->getChunkStream("CURS"));
_graphicsManager->init();
Commit: 98c929168253c422ee2fc925aeb5223f34c9eb8c
https://github.com/scummvm/scummvm/commit/98c929168253c422ee2fc925aeb5223f34c9eb8c
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-01-31T22:55:57+01:00
Commit Message:
NANCY: Rename incorrectly named parameter
Changed paths:
engines/nancy/commontypes.cpp
engines/nancy/commontypes.h
engines/nancy/state/scene.cpp
diff --git a/engines/nancy/commontypes.cpp b/engines/nancy/commontypes.cpp
index e59cccace06..a573f18b423 100644
--- a/engines/nancy/commontypes.cpp
+++ b/engines/nancy/commontypes.cpp
@@ -392,7 +392,7 @@ void StaticData::readData(Common::SeekableReadStream &stream, Common::Language l
logoEndAfter = stream.readUint32LE();
if (minorVersion == 1) {
- wonGameSceneID = stream.readUint16LE();
+ wonGameFlagID = stream.readUint16LE();
}
break;
diff --git a/engines/nancy/commontypes.h b/engines/nancy/commontypes.h
index bab219a81d4..f1265640d2c 100644
--- a/engines/nancy/commontypes.h
+++ b/engines/nancy/commontypes.h
@@ -319,7 +319,7 @@ struct StaticData {
Common::Array<uint16> genericEventFlags;
uint16 numCursorTypes = 4;
uint32 logoEndAfter = 7000;
- int16 wonGameSceneID = -1;
+ int16 wonGameFlagID = -1;
// Data for sound channels
SoundChannelInfo soundChannelInfo;
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index 2eddbe30bf7..21e65893025 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -801,7 +801,7 @@ void Scene::init() {
// Set relevant event flag when player has won the game at least once
if (ConfMan.get("PlayerWonTheGame", ConfMan.getActiveDomainName()) == "AcedTheGame") {
- setEventFlag(g_nancy->getStaticData().wonGameSceneID, g_nancy->_true);
+ setEventFlag(g_nancy->getStaticData().wonGameFlagID, g_nancy->_true);
}
if (g_nancy->getGameType() == kGameTypeVampire) {
More information about the Scummvm-git-logs
mailing list