[Scummvm-git-logs] scummvm master -> 3c87b877a6b7bf5337ee9312b46ea9b34e5ed2f7
bluegr
noreply at scummvm.org
Sun May 3 09:00:20 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:
7eeff19122 NANCY: Refactor more uses of friend class
3c87b877a6 NANCY: Use string formatting for the soundInfo debug command
Commit: 7eeff191221dbeac72373892fe221febea824b44
https://github.com/scummvm/scummvm/commit/7eeff191221dbeac72373892fe221febea824b44
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-05-03T11:54:35+03:00
Commit Message:
NANCY: Refactor more uses of friend class
Changed paths:
engines/nancy/action/conversation.cpp
engines/nancy/action/conversation.h
engines/nancy/cif.cpp
engines/nancy/cif.h
engines/nancy/resource.cpp
engines/nancy/video.cpp
engines/nancy/video.h
diff --git a/engines/nancy/action/conversation.cpp b/engines/nancy/action/conversation.cpp
index 58b3a7e5631..f652260a89e 100644
--- a/engines/nancy/action/conversation.cpp
+++ b/engines/nancy/action/conversation.cpp
@@ -723,24 +723,11 @@ public:
ConversationCelLoader(ConversationCel &owner) : _owner(owner) {}
private:
- bool loadInner() override;
+ bool loadInner() override { return _owner.load(); }
ConversationCel &_owner;
};
-bool ConversationCelLoader::loadInner() {
- for (uint i = _owner._curFrame; i < _owner._celNames[0].size(); ++i) {
- for (uint j = 0; j < _owner._celRObjects.size(); ++j) {
- if (!_owner._celCache.contains(_owner._celNames[j][i])) {
- _owner.loadCel(_owner._celNames[j][i], _owner._treeNames[j]);
- return false;
- }
- }
- }
-
- return true;
-}
-
ConversationCel::~ConversationCel() {
// Make sure there isn't a single-frame gap between conversation scenes where
// the character is invisible
@@ -875,6 +862,19 @@ ConversationCel::Cel &ConversationCel::loadCel(const Common::Path &name, const C
return _celCache[name];
}
+bool ConversationCel::load() {
+ for (uint i = _curFrame; i < _celNames[0].size(); ++i) {
+ for (uint j = 0; j < _celRObjects.size(); ++j) {
+ if (!_celCache.contains(_celNames[j][i])) {
+ loadCel(_celNames[j][i], _treeNames[j]);
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
void ConversationSoundTerse::readData(Common::SeekableReadStream &stream) {
readTerseData(stream);
}
diff --git a/engines/nancy/action/conversation.h b/engines/nancy/action/conversation.h
index a24f1183d3f..558b69ad2e9 100644
--- a/engines/nancy/action/conversation.h
+++ b/engines/nancy/action/conversation.h
@@ -161,7 +161,6 @@ class ConversationCelLoader;
// Conversation with separate cels for the body and head of the character.
// Cels are separate images bundled inside a .cal file
class ConversationCel : public ConversationSound {
- friend class ConversationCelLoader;
public:
ConversationCel() {}
virtual ~ConversationCel();
@@ -172,6 +171,9 @@ public:
void readData(Common::SeekableReadStream &stream) override;
+ bool load();
+ uint getCurFrame() const { return _curFrame; }
+
protected:
Common::String getRecordTypeName() const override { return "ConversationCel"; }
diff --git a/engines/nancy/cif.cpp b/engines/nancy/cif.cpp
index 48294eea031..43ecc5f41bc 100644
--- a/engines/nancy/cif.cpp
+++ b/engines/nancy/cif.cpp
@@ -343,6 +343,18 @@ bool CifTree::sync(Common::Serializer &ser) {
return true;
}
+Common::Array<Common::Path> CifTree::getPathsForType(CifInfo::ResType type) const {
+ Common::Array<Common::Path> pathList;
+
+ for (auto &it : _fileMap) {
+ if (type == CifInfo::kResTypeAny || it._value.type == type) {
+ pathList.push_back(it._key);
+ }
+ }
+
+ return pathList;
+}
+
bool PatchTree::hasFile(const Common::Path &path) const {
if (CifTree::hasFile(path)) {
// An association is just a Pair of two StringArrays
diff --git a/engines/nancy/cif.h b/engines/nancy/cif.h
index 78e1b1b236f..8a30df2036f 100644
--- a/engines/nancy/cif.h
+++ b/engines/nancy/cif.h
@@ -78,7 +78,6 @@ private:
// Container type comprising of multiple CIF files. Contrary to its name it contains no tree structure.
class CifTree : public Common::Archive {
- friend class ResourceManager;
public:
CifTree() : _stream(nullptr) {}
CifTree(Common::SeekableReadStream *stream, const Common::Path &name);
@@ -101,6 +100,11 @@ public:
bool sync(Common::Serializer &ser);
void addInfo(const CifInfo &info) { _writeFileMap.push_back(info); }
+ uint writeFileMapSize() const { return _writeFileMap.size(); }
+ uint32 getDataOffset(uint i) const { return _writeFileMap[i].dataOffset; }
+ void setDataOffset(uint i, uint32 offset) { _writeFileMap[i].dataOffset = offset; }
+
+ Common::Array<Common::Path> getPathsForType(CifInfo::ResType type = CifInfo::kResTypeAny) const;
private:
Common::Path _name;
diff --git a/engines/nancy/resource.cpp b/engines/nancy/resource.cpp
index f779fe3cf28..5b63092907c 100644
--- a/engines/nancy/resource.cpp
+++ b/engines/nancy/resource.cpp
@@ -293,22 +293,14 @@ void ResourceManager::list(const Common::String &treeName, Common::Array<Common:
if (!tree) {
return;
}
- for (auto &i : tree->_fileMap) {
- if (type == CifInfo::kResTypeAny || i._value.type == type) {
- outList.push_back(i._key);
- }
- }
+ outList = tree->getPathsForType(type);
} else {
for (uint i = 0; i < _cifTreeNames.size(); ++i) {
// No provided tree name, check inside every loaded tree
Common::String upper = _cifTreeNames[i];
upper.toUppercase();
const CifTree *tree = (const CifTree *)SearchMan.getArchive(treePrefix + upper);
- for (auto &it : tree->_fileMap) {
- if (type == CifInfo::kResTypeAny || it._value.type == type) {
- outList.push_back(it._key);
- }
- }
+ outList = tree->getPathsForType(type);
}
}
}
@@ -459,11 +451,11 @@ bool ResourceManager::exportCifTree(const Common::String &treeName, const Common
file.addInfo(info);
}
- uint16 dataOffset = headerSize + file._writeFileMap.size() * infoSize; // Initial offset after header/infos
- for (uint i = 0; i < file._writeFileMap.size(); ++i) {
- file._writeFileMap[i].dataOffset = dataOffset;
+ uint16 dataOffset = headerSize + file.writeFileMapSize() * infoSize; // Initial offset after header/infos
+ for (uint i = 0; i < file.writeFileMapSize(); ++i) {
+ file.setDataOffset(i, dataOffset);
for (uint j = 0; j < i; ++j) {
- file._writeFileMap[i].dataOffset += resStreams[j]->size(); // Final offset, following raw data of previous files
+ file.setDataOffset(i, file.getDataOffset(i) + resStreams[j]->size()); // Final offset, following raw data of previous files
}
}
diff --git a/engines/nancy/video.cpp b/engines/nancy/video.cpp
index f83488d3e11..5d4359c5b58 100644
--- a/engines/nancy/video.cpp
+++ b/engines/nancy/video.cpp
@@ -42,9 +42,9 @@ private:
};
bool VideoCacheLoader::loadInner() {
- AVFDecoder::CacheHint hint = _owner._cacheHint;
- int frameID = _owner._curFrame;
- int frameCount = _owner._frameCount;
+ AVFDecoder::CacheHint hint = _owner.getCacheHint();
+ int frameID = _owner.getCurFrame();
+ int frameCount = _owner.getFrameCount();
for (int i = 0; i < frameCount; ++i) {
if (frameID < 0) {
@@ -55,16 +55,16 @@ bool VideoCacheLoader::loadInner() {
frameID -= frameCount;
}
- if (!_owner._frameCache[frameID].getPixels()) {
+ if (!_owner.getSurfaceForFrame(frameID)->getPixels()) {
_owner.decodeFrame(frameID);
return false;
}
// Select next frame based on hint and play direction
if (hint != AVFDecoder::kLoadBidirectional) {
- frameID = _owner._reversed ? frameID - 1 : frameID + 1;
+ frameID = _owner.isReversed() ? frameID - 1 : frameID + 1;
} else {
- frameID = _owner._curFrame + (i % 2 ? i >> 1 : -(i >> 1));
+ frameID = _owner.getCurFrame() + (i % 2 ? i >> 1 : -(i >> 1));
}
}
diff --git a/engines/nancy/video.h b/engines/nancy/video.h
index 62093ab0549..2e6224a2d3c 100644
--- a/engines/nancy/video.h
+++ b/engines/nancy/video.h
@@ -54,7 +54,6 @@ public:
private:
CacheHint _cacheHint;
class AVFVideoTrack : public FixedRateVideoTrack {
- friend class VideoCacheLoader;
public:
AVFVideoTrack(Common::SeekableReadStream *stream, uint32 chunkFileFormat, CacheHint cacheHint);
virtual ~AVFVideoTrack();
@@ -71,7 +70,9 @@ private:
bool endOfTrack() const override;
const Graphics::Surface *decodeNextFrame() override;
const Graphics::Surface *decodeFrame(uint frameNr);
+ const Graphics::Surface *getSurfaceForFrame(uint frameNr) { return &_frameCache[frameNr]; }
void addFrameTime(const uint16 timeToAdd) { _frameTime += timeToAdd; }
+ CacheHint getCacheHint() const { return _cacheHint; }
protected:
Common::Rational getFrameRate() const override { return Common::Rational(1000, _frameTime); }
Commit: 3c87b877a6b7bf5337ee9312b46ea9b34e5ed2f7
https://github.com/scummvm/scummvm/commit/3c87b877a6b7bf5337ee9312b46ea9b34e5ed2f7
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-05-03T11:54:36+03:00
Commit Message:
NANCY: Use string formatting for the soundInfo debug command
Changed paths:
engines/nancy/console.cpp
diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 13a601c3ee1..82b06b4f2ca 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -1027,7 +1027,7 @@ bool NancyConsole::Cmd_soundInfo(int argc, const char **argv) {
}
for (byte channelID : channelIDs) {
- debugPrintf(g_nancy->_sound->getChannelInfo(channelID).c_str());
+ debugPrintf("%s", g_nancy->_sound->getChannelInfo(channelID).c_str());
}
return true;
More information about the Scummvm-git-logs
mailing list