[Scummvm-git-logs] scummvm master -> 283dcbb2f588915aa1d2e6a22a88eae9b4e498d6
fracturehill
noreply at scummvm.org
Sun Feb 4 00:31:48 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fde77e4312 NANCY: Implement custom cursors
283dcbb2f5 NANCY: Support nancy7 RippedLetterPuzzle
Commit: fde77e43122d0ae05bc03dd693ffabaa662db0d5
https://github.com/scummvm/scummvm/commit/fde77e43122d0ae05bc03dd693ffabaa662db0d5
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-02-04T00:32:40+01:00
Commit Message:
NANCY: Implement custom cursors
Added support for the two (four) custom cursor types.
It's unclear where exactly these get used, but it's most likely
in some puzzles.
Changed paths:
engines/nancy/action/miscrecords.cpp
engines/nancy/cursor.h
diff --git a/engines/nancy/action/miscrecords.cpp b/engines/nancy/action/miscrecords.cpp
index 41e6588e5ef..29e2f56699c 100644
--- a/engines/nancy/action/miscrecords.cpp
+++ b/engines/nancy/action/miscrecords.cpp
@@ -316,10 +316,14 @@ void EventFlagsMultiHS::execute() {
break;
case kActionTrigger:
- _hasHotspot = false;
- EventFlags::execute();
- finishExecution();
- break;
+ if (_hoverCursor != CursorManager::kCustom1 && _hoverCursor != CursorManager::kCustom2) {
+ _hasHotspot = false;
+ EventFlags::execute();
+ finishExecution();
+ break;
+ } else {
+ _state = kRun;
+ }
}
}
diff --git a/engines/nancy/cursor.h b/engines/nancy/cursor.h
index eccfd2df450..eb8808ed389 100644
--- a/engines/nancy/cursor.h
+++ b/engines/nancy/cursor.h
@@ -51,6 +51,10 @@ public:
kRotateRight = 13, // Used in 360 scenes in nancy6 and up
kInvertedRotateRight = 14, // Used in 360 scenes with inverted rotation; nancy6 and up
kInvertedRotateLeft = 15, // Used in 360 scenes with inverted rotation; nancy6 and up
+ kCustom1 = 16, // Custom cursors change between games; Likely used in puzzles
+ kCustom1Hotspot = 17,
+ kCustom2 = 18,
+ kCustom2Hotspot = 19,
kNormalArrow,
kHotspotArrow
};
Commit: 283dcbb2f588915aa1d2e6a22a88eae9b4e498d6
https://github.com/scummvm/scummvm/commit/283dcbb2f588915aa1d2e6a22a88eae9b4e498d6
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-02-04T01:30:30+01:00
Commit Message:
NANCY: Support nancy7 RippedLetterPuzzle
The puzzle got some changes in nancy7, allowing it to
only rotate 180 degrees or skip rotation entirely, and just
reorder elements instead. Also, a custom pick up graphic
can be used instead of the individual elements; this is used
in the folder reordering puzzle, where a picked up folder
is shown in full.
Changed paths:
engines/nancy/action/puzzle/rippedletterpuzzle.cpp
engines/nancy/action/puzzle/rippedletterpuzzle.h
diff --git a/engines/nancy/action/puzzle/rippedletterpuzzle.cpp b/engines/nancy/action/puzzle/rippedletterpuzzle.cpp
index 21740ec4ec4..5170c09597c 100644
--- a/engines/nancy/action/puzzle/rippedletterpuzzle.cpp
+++ b/engines/nancy/action/puzzle/rippedletterpuzzle.cpp
@@ -44,10 +44,15 @@ void RippedLetterPuzzle::init() {
setVisible(true);
moveTo(screenBounds);
- _pickedUpPiece._drawSurface.create(_destRects[0].width(), _destRects[0].height(), g_nancy->_graphicsManager->getInputPixelFormat());
- _pickedUpPiece.setVisible(false);
-
g_nancy->_resource->loadImage(_imageName, _image);
+
+ if (_useCustomPickUpTile) {
+ _pickedUpPiece._drawSurface.create(_image, _customPickUpTileSrc);
+ } else {
+ _pickedUpPiece._drawSurface.create(_destRects[0].width(), _destRects[0].height(), g_nancy->_graphicsManager->getInputPixelFormat());
+ }
+
+ _pickedUpPiece.setVisible(false);
}
void RippedLetterPuzzle::registerGraphics() {
@@ -61,8 +66,10 @@ void RippedLetterPuzzle::readData(Common::SeekableReadStream &stream) {
readFilename(stream, _imageName);
- byte width = 6;
- byte height = 4;
+ byte maxWidth = 6;
+ byte maxHeight = g_nancy->getGameType() <= kGameTypeNancy6 ? 4 : 5;
+ byte width = maxWidth;
+ byte height = maxHeight;
if (g_nancy->getGameType() >= kGameTypeNancy5) {
width = stream.readByte();
@@ -70,54 +77,63 @@ void RippedLetterPuzzle::readData(Common::SeekableReadStream &stream) {
}
for (uint i = 0; i < height; ++i) {
- readRectArray(stream, _srcRects, width, 6);
+ readRectArray(stream, _srcRects, width, maxWidth);
}
- stream.skip((4 - height) * 6 * 16);
+ stream.skip((maxHeight - height) * maxWidth * 16);
for (uint i = 0; i < height; ++i) {
- readRectArray(stream, _destRects, width, 6);
+ readRectArray(stream, _destRects, width, maxWidth);
}
- stream.skip((4 - height) * 6 * 16);
+ stream.skip((maxHeight - height) * maxWidth * 16);
readRect(stream, _rotateHotspot);
readRect(stream, _takeHotspot);
readRect(stream, _dropHotspot);
+ if (g_nancy->getGameType() >= kGameTypeNancy7) {
+ _rotationType = (RotationType)stream.readUint16LE();
+ }
+
_initOrder.resize(width * height);
for (uint i = 0; i < height; ++i) {
for (uint j = 0; j < width; ++j) {
_initOrder[i * width + j] = stream.readByte();
}
- stream.skip((6 - width));
+ stream.skip((maxWidth - width));
}
- stream.skip((4 - height) * 6);
+ stream.skip((maxHeight - height) * maxWidth);
_initRotations.resize(width * height);
for (uint i = 0; i < height; ++i) {
for (uint j = 0; j < width; ++j) {
_initRotations[i * width + j] = stream.readByte();
}
- stream.skip((6 - width));
+ stream.skip((maxWidth - width));
}
- stream.skip((4 - height) * 6);
+ stream.skip((maxHeight - height) * maxWidth);
_solveOrder.resize(width * height);
for (uint i = 0; i < height; ++i) {
for (uint j = 0; j < width; ++j) {
_solveOrder[i * width + j] = stream.readByte();
}
- stream.skip((6 - width));
+ stream.skip((maxWidth - width));
}
- stream.skip((4 - height) * 6);
+ stream.skip((maxHeight - height) * maxWidth);
_solveRotations.resize(width * height);
for (uint i = 0; i < height; ++i) {
for (uint j = 0; j < width; ++j) {
_solveRotations[i * width + j] = stream.readByte();
}
- stream.skip((6 - width));
+ stream.skip((maxWidth - width));
+ }
+ stream.skip((maxHeight - height) * maxWidth);
+
+ if (g_nancy->getGameType() >= kGameTypeNancy7) {
+ _useCustomPickUpTile = stream.readByte();
+ readRect(stream, _customPickUpTileSrc);
}
- stream.skip((4 - height) * 6);
_takeSound.readNormal(stream);
_dropSound.readNormal(stream);
@@ -211,13 +227,14 @@ void RippedLetterPuzzle::handleInput(NancyInput &input) {
insideRect = _rotateHotspot;
insideRect.translate(screenHotspot.left, screenHotspot.top);
- if (insideRect.contains(input.mousePos)) {
+ if (_rotationType != kRotationNone && insideRect.contains(input.mousePos)) {
g_nancy->_cursorManager->setCursorType(CursorManager::kRotateCW);
if (input.input & NancyInput::kLeftMouseButtonUp) {
// Player has clicked, rotate the piece
- if (++_puzzleState->rotations[i] > 3) {
- _puzzleState->rotations[i] = 0;
+ int inc = (_rotationType == kRotation90 ? 1 : 2);
+ if ((_puzzleState->rotations[i] += inc) > 3) {
+ _puzzleState->rotations[i] -= 4;
}
drawPiece(i, _puzzleState->rotations[i], _puzzleState->order[i]);
@@ -238,8 +255,11 @@ void RippedLetterPuzzle::handleInput(NancyInput &input) {
// Player has clicked, take the piece
// First, copy the graphic from the full drawSurface...
- _pickedUpPiece._drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
- _pickedUpPiece._drawSurface.blitFrom(_drawSurface, _destRects[i], Common::Point());
+ if (!_useCustomPickUpTile) {
+ _pickedUpPiece._drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
+ _pickedUpPiece._drawSurface.blitFrom(_drawSurface, _destRects[i], Common::Point());
+ }
+
_pickedUpPiece.setVisible(true);
_pickedUpPiece.setTransparent(true);
_pickedUpPiece.pickUp();
@@ -276,8 +296,11 @@ void RippedLetterPuzzle::handleInput(NancyInput &input) {
_pickedUpPiece.setVisible(false);
} else {
// Yes, change the picked piece graphic
- _pickedUpPiece._drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
- _pickedUpPiece._drawSurface.blitFrom(_drawSurface, _destRects[i], Common::Point());
+ if (!_useCustomPickUpTile) {
+ _pickedUpPiece._drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
+ _pickedUpPiece._drawSurface.blitFrom(_drawSurface, _destRects[i], Common::Point());
+ }
+
_pickedUpPiece.setVisible(true);
_pickedUpPiece.setTransparent(true);
}
diff --git a/engines/nancy/action/puzzle/rippedletterpuzzle.h b/engines/nancy/action/puzzle/rippedletterpuzzle.h
index ddbe35483dd..09fe7c942a5 100644
--- a/engines/nancy/action/puzzle/rippedletterpuzzle.h
+++ b/engines/nancy/action/puzzle/rippedletterpuzzle.h
@@ -34,6 +34,7 @@ namespace Action {
class RippedLetterPuzzle : public RenderActionRecord {
public:
enum SolveState { kNotSolved, kWaitForSound };
+ enum RotationType { kRotationNone = 0, kRotation90 = 1, kRotation180 = 2 };
RippedLetterPuzzle() : RenderActionRecord(7) {}
virtual ~RippedLetterPuzzle() {}
@@ -44,20 +45,31 @@ public:
void handleInput(NancyInput &input) override;
Common::Path _imageName;
+
Common::Array<Common::Rect> _srcRects;
Common::Array<Common::Rect> _destRects;
+
Common::Rect _rotateHotspot;
Common::Rect _takeHotspot;
Common::Rect _dropHotspot;
+
+ RotationType _rotationType = kRotation90;
+
Common::Array<int8> _initOrder;
Common::Array<byte> _initRotations;
Common::Array<int8> _solveOrder;
Common::Array<byte> _solveRotations;
+
+ bool _useCustomPickUpTile = false;
+ Common::Rect _customPickUpTileSrc;
+
SoundDescription _takeSound;
SoundDescription _dropSound;
SoundDescription _rotateSound;
+
SceneChangeWithFlag _solveExitScene;
SoundDescription _solveSound;
+
SceneChangeWithFlag _exitScene;
Common::Rect _exitHotspot;
More information about the Scummvm-git-logs
mailing list