[Scummvm-git-logs] scummvm master -> b50d3d8c83e4c2043244ccf880c340aab07e4d89
fracturehill
noreply at scummvm.org
Sun Nov 5 21:16:35 UTC 2023
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:
939d3d0e46 NANCY: Adjust volume when playing same sound twice
732abddabe NANCY: Improve reading of Overlays
7303fa4a44 NANCY: Extend Overlay looping behavior to nancy2
b50d3d8c83 NANCY: Add extra GUI options for nancy2 patches
Commit: 939d3d0e46a032979738cd6d53e430e945afa2cb
https://github.com/scummvm/scummvm/commit/939d3d0e46a032979738cd6d53e430e945afa2cb
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-11-05T23:15:46+02:00
Commit Message:
NANCY: Adjust volume when playing same sound twice
Earlier games did not have a StopSound action record, so
there is at least one scene in nancy2 where, in order to get
a sound to stop playing, the devs just played it again but
with a zero volume. In such cases, we now adjust the
volume of the sound being played without restarting it.
Changed paths:
engines/nancy/sound.cpp
diff --git a/engines/nancy/sound.cpp b/engines/nancy/sound.cpp
index b68553264e9..fba51b778ea 100644
--- a/engines/nancy/sound.cpp
+++ b/engines/nancy/sound.cpp
@@ -156,6 +156,14 @@ bool readHISHeader(Common::SeekableReadStream *stream, SoundType &type, uint16 &
return true;
}
+uint getAdjustedVolume(uint volume) {
+ if (g_nancy->getGameType() >= kGameTypeNancy3) {
+ return 10 + (volume * 90) / 100;
+ } else {
+ return volume;
+ }
+}
+
Audio::SeekableAudioStream *SoundManager::makeHISStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 overrideSamplesPerSec) {
char buf[22];
@@ -262,6 +270,12 @@ void SoundManager::loadSound(const SoundDescription &description, SoundEffectDes
if ( description.name == existing.name &&
description.numLoops == existing.numLoops &&
description.playCommands == existing.playCommands) {
+
+ // When the same sound is already playing at a different volume, adjust to new volume (nancy2 scene 599)
+ if (existing.volume != getAdjustedVolume(description.volume)) {
+ setVolume(description, description.volume);
+ }
+
return;
}
}
@@ -304,9 +318,7 @@ void SoundManager::playSound(uint16 channelID) {
// Set a minimum volume (10 percent was chosen arbitrarily, but sounds reasonably close)
// Fix for nancy3 scene 6112, but NOT a hack; the original engine also set a minimum volume for all sounds
- if (g_nancy->getGameType() >= kGameTypeNancy3) {
- chan.volume = 10 + ((int)chan.volume * 90) / 100;
- }
+ chan.volume = getAdjustedVolume(chan.volume);
// Init 3D sound
if (chan.playCommands & ~kPlaySequential && chan.effectData) {
@@ -501,7 +513,7 @@ void SoundManager::setVolume(uint16 channelID, uint16 volume) {
if (channelID >= _channels.size() || !isSoundPlaying(channelID))
return;
- _mixer->setChannelVolume(_channels[channelID].handle, volume * 255 / 100);
+ _mixer->setChannelVolume(_channels[channelID].handle, getAdjustedVolume(volume) * 255 / 100);
}
void SoundManager::setVolume(const SoundDescription &description, uint16 volume) {
Commit: 732abddabe03999b0147a168c4b5c80e340c8026
https://github.com/scummvm/scummvm/commit/732abddabe03999b0147a168c4b5c80e340c8026
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-11-05T23:15:46+02:00
Commit Message:
NANCY: Improve reading of Overlays
A source parameter that was previously erroneously
skipped is now read correctly, resulting in a lot of the
static mode code being no longer needed.
Changed paths:
engines/nancy/action/overlay.cpp
engines/nancy/commontypes.cpp
engines/nancy/commontypes.h
diff --git a/engines/nancy/action/overlay.cpp b/engines/nancy/action/overlay.cpp
index 38af9db5866..8dcb6f8e901 100644
--- a/engines/nancy/action/overlay.cpp
+++ b/engines/nancy/action/overlay.cpp
@@ -313,54 +313,31 @@ void Overlay::setFrame(uint frame) {
return;
}
- // Static mode overlays are an absolute mess, and use both the general source rects (_srcRects),
+ // Static mode overlays use both the general source rects (_srcRects),
// and the ones inside the blit description struct corresponding to the current scene background.
- if (_srcRects.size() > 1) {
- // First, the order of the blit descriptions does not necessarily correspond to the order of
- // the general rects, as the general rects are ordered based on the scene's background frame id,
- // while the blit descriptions can be in arbitrary order.
- // An example is nancy4 scene 3500, where the overlay appears on background frames 0, 1, 2, 18 and 19,
- // while the blit descriptions are in order 18, 19, 0, 1, 2. Thus, if we don't do the counting below
- // we get wildly inaccurate results.
- uint srcID = 0;
-
- for (int i = 0; i < _currentViewportFrame; ++i) {
- for (uint j = 0; j < _blitDescriptions.size(); ++j) {
- if (_blitDescriptions[j].frameID == i) {
- ++srcID;
- continue;
- }
- }
- }
-
- srcRect = _srcRects[srcID];
- } else {
- // Second, the number of general source rects may also be just one, in which case it's valid
- // for every blit description (nancy4 scene 1300)
- srcRect = _srcRects[0];
- }
-
- Common::Rect staticSrc = _blitDescriptions[frame].src;
+ // BlitDescriptions contain the id of the source rect to actually use
+ srcRect = _srcRects[_blitDescriptions[frame].staticRectID];
+ Common::Rect staticBounds = _blitDescriptions[frame].src;
if (_usesAutotext) {
// For autotext overlays, the srcRect is junk data
- srcRect = staticSrc;
+ srcRect = staticBounds;
} else {
// Lastly, the general source rect we just got may also be completely empty (nancy5 scenes 2056, 2057),
// or have coordinates other than (0, 0) (nancy3 scene 3070, nancy5 scene 2000). Presumably,
// the general source rect was used for blitting to an (optional) intermediate surface, while the ones
// inside the blit description below were used for blitting from that intermediate surface to the screen.
// We can achieve the same results by doung the calculations below
- srcRect.translate(staticSrc.left, staticSrc.top);
+ srcRect.translate(staticBounds.left, staticBounds.top);
if (srcRect.isEmpty()) {
- srcRect.setWidth(staticSrc.width());
- srcRect.setHeight(staticSrc.height());
+ srcRect.setWidth(staticBounds.width());
+ srcRect.setHeight(staticBounds.height());
} else {
// Grab whichever dimensions are smaller. Fixes the book in nancy5 scene 3000
- srcRect.setWidth(MIN<int>(staticSrc.width(), srcRect.width()));
- srcRect.setHeight(MIN<int>(staticSrc.height(), srcRect.height()));
+ srcRect.setWidth(MIN<int>(staticBounds.width(), srcRect.width()));
+ srcRect.setHeight(MIN<int>(staticBounds.height(), srcRect.height()));
}
}
}
diff --git a/engines/nancy/commontypes.cpp b/engines/nancy/commontypes.cpp
index 73bbe51ca63..329630393fc 100644
--- a/engines/nancy/commontypes.cpp
+++ b/engines/nancy/commontypes.cpp
@@ -97,8 +97,8 @@ void FrameBlitDescription::readData(Common::SeekableReadStream &stream, bool lon
frameID = stream.readUint16LE();
if (longFormat) {
- // Related to static mode, seems to be a frame ID? However, it is always set to zero so we skip it.
- stream.skip(2);
+ // In static mode Overlays, this is the id of the _srcRect to be used
+ staticRectID = stream.readUint16LE();
}
if (g_nancy->getGameType() >= kGameTypeNancy3 && longFormat) {
diff --git a/engines/nancy/commontypes.h b/engines/nancy/commontypes.h
index 5ba851f09d5..0e0aa90ebf5 100644
--- a/engines/nancy/commontypes.h
+++ b/engines/nancy/commontypes.h
@@ -180,6 +180,7 @@ struct HotspotDescription {
// Describes a blit operation, dependent on a background frame
struct FrameBlitDescription {
uint16 frameID = 0; // Frame ID of the Scene background
+ uint16 staticRectID = 0; // Used in Overlay
uint hasHotspot = kPlayOverlayNoHotspot;
Common::Rect src;
Common::Rect dest;
Commit: 7303fa4a44c2f15ebed4eb5e04d38017d8d9a832
https://github.com/scummvm/scummvm/commit/7303fa4a44c2f15ebed4eb5e04d38017d8d9a832
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-11-05T23:15:47+02:00
Commit Message:
NANCY: Extend Overlay looping behavior to nancy2
It seems nancy2 shares the weird looping behavior when
a sound is present inside an Overlay - it keeps looping
until after the sound is done, even when looping is disabled.
This fixes nancy2 scene 1562.
Changed paths:
engines/nancy/action/overlay.cpp
diff --git a/engines/nancy/action/overlay.cpp b/engines/nancy/action/overlay.cpp
index 8dcb6f8e901..991fb03f472 100644
--- a/engines/nancy/action/overlay.cpp
+++ b/engines/nancy/action/overlay.cpp
@@ -203,8 +203,8 @@ void Overlay::execute() {
if (_playDirection == kPlayOverlayReverse) {
if (nextFrame - frameDiff < _loopFirstFrame) {
- // We keep looping if sound is present (nancy1 only)
- if (_loop == kPlayOverlayLoop || (_sound.name != "NO SOUND" && g_nancy->getGameType() == kGameTypeNancy1)) {
+ // We keep looping if sound is present (nancy1/2 only)
+ if (_loop == kPlayOverlayLoop || (_sound.name != "NO SOUND" && g_nancy->getGameType() <= kGameTypeNancy2)) {
nextFrame = _loopLastFrame - (frameDiff % (_loopLastFrame - _loopFirstFrame + 1));
}
} else {
@@ -212,7 +212,7 @@ void Overlay::execute() {
}
} else {
if (nextFrame + frameDiff > _loopLastFrame) {
- if (_loop == kPlayOverlayLoop || (_sound.name != "NO SOUND" && g_nancy->getGameType() == kGameTypeNancy1)) {
+ if (_loop == kPlayOverlayLoop || (_sound.name != "NO SOUND" && g_nancy->getGameType() <= kGameTypeNancy2)) {
nextFrame = _loopFirstFrame + (frameDiff % (_loopLastFrame - _loopFirstFrame + 1));
}
} else {
Commit: b50d3d8c83e4c2043244ccf880c340aab07e4d89
https://github.com/scummvm/scummvm/commit/b50d3d8c83e4c2043244ccf880c340aab07e4d89
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-11-05T23:15:47+02:00
Commit Message:
NANCY: Add extra GUI options for nancy2 patches
Changed paths:
engines/nancy/detection.cpp
engines/nancy/detection.h
engines/nancy/metaengine.cpp
diff --git a/engines/nancy/detection.cpp b/engines/nancy/detection.cpp
index 938946abdc9..8b3a9a45eb9 100644
--- a/engines/nancy/detection.cpp
+++ b/engines/nancy/detection.cpp
@@ -54,6 +54,8 @@ static const PlainGameDescriptor nancyGames[] = {
{ nullptr, nullptr }
};
+#define NANCY2_GUIOPTIONS GUIO4(GAMEOPTION_PLAYER_SPEECH, GAMEOPTION_CHARACTER_SPEECH, GAMEOPTION_FIX_SOFTLOCKS, GAMEOPTION_NANCY2_TIMER)
+
static const Nancy::NancyGameDescription gameDescriptions[] = {
{ // MD5 by fracturehill
@@ -114,7 +116,7 @@ static const Nancy::NancyGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE | ADGF_DROPPLATFORM,
- GUIO2(GAMEOPTION_PLAYER_SPEECH, GAMEOPTION_CHARACTER_SPEECH)
+ NANCY2_GUIOPTIONS
},
Nancy::kGameTypeNancy2
},
@@ -125,7 +127,7 @@ static const Nancy::NancyGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_UNSTABLE | ADGF_DROPPLATFORM,
- GUIO2(GAMEOPTION_PLAYER_SPEECH, GAMEOPTION_CHARACTER_SPEECH)
+ NANCY2_GUIOPTIONS
},
Nancy::kGameTypeNancy2
},
@@ -142,7 +144,7 @@ static const Nancy::NancyGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_UNSTABLE | ADGF_DROPPLATFORM | Nancy::GF_COMPRESSED,
- GUIO2(GAMEOPTION_PLAYER_SPEECH, GAMEOPTION_CHARACTER_SPEECH)
+ NANCY2_GUIOPTIONS
},
Nancy::kGameTypeNancy2
},
diff --git a/engines/nancy/detection.h b/engines/nancy/detection.h
index 1afe32cd0cc..2e002abd051 100644
--- a/engines/nancy/detection.h
+++ b/engines/nancy/detection.h
@@ -58,9 +58,17 @@ enum NancyDebugChannels {
kDebugVideo = 1 << 4
};
-#define GAMEOPTION_PLAYER_SPEECH GUIO_GAMEOPTIONS1
-#define GAMEOPTION_CHARACTER_SPEECH GUIO_GAMEOPTIONS2
-#define GAMEOPTION_AUTO_MOVE GUIO_GAMEOPTIONS3
+// Settings found in the original engine
+#define GAMEOPTION_PLAYER_SPEECH GUIO_GAMEOPTIONS1
+#define GAMEOPTION_CHARACTER_SPEECH GUIO_GAMEOPTIONS2
+#define GAMEOPTION_AUTO_MOVE GUIO_GAMEOPTIONS3
+
+// Patch settings, general
+#define GAMEOPTION_FIX_SOFTLOCKS GUIO_GAMEOPTIONS4
+#define GAMEOPTION_FIX_ANNOYANCES GUIO_GAMEOPTIONS5
+
+// Patch settings, specific to each game
+#define GAMEOPTION_NANCY2_TIMER GUIO_GAMEOPTIONS6
} // End of namespace Nancy
diff --git a/engines/nancy/metaengine.cpp b/engines/nancy/metaengine.cpp
index b82898b64f6..d79f81bee33 100644
--- a/engines/nancy/metaengine.cpp
+++ b/engines/nancy/metaengine.cpp
@@ -65,6 +65,39 @@ static const ADExtraGuiOptionsMap optionsList[] = {
0
}
},
+ {
+ GAMEOPTION_FIX_SOFTLOCKS,
+ {
+ _s("Fix softlocks"),
+ _s("Fix instances where missing something earlier in the game blocks you from progressing any further."),
+ "softlocks_fix",
+ true,
+ 0,
+ 0
+ }
+ },
+ {
+ GAMEOPTION_FIX_ANNOYANCES,
+ {
+ _s("Fix annoyances"),
+ _s("Fix various minor annoyances."),
+ "annoyances_fix",
+ true,
+ 0,
+ 0
+ }
+ },
+ {
+ GAMEOPTION_NANCY2_TIMER,
+ {
+ _s("Extend endgame timer"),
+ _s("Get a little more time before failing the final puzzle. This is an official patch by HeR Interactive."),
+ "final_timer",
+ false,
+ 0,
+ 0
+ }
+ },
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
More information about the Scummvm-git-logs
mailing list