MCPcopy Create free account
hub / github.com/crossuo/crossuo / UopReadAnimationFrameInfo

Method UopReadAnimationFrameInfo

xuocore/uodata.cpp:1318–1344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1316}
1317
1318void CFileManager::UopReadAnimationFrameInfo(
1319 AnimationFrameInfo &result,
1320 AnimationDirection &direction,
1321 const UopFileEntry *block,
1322 bool isCorpse)
1323{
1324 if (block == nullptr || block->Hash == 0)
1325 {
1326 return;
1327 }
1328
1329 std::vector<uint8_t> scratchBuffer;
1330 scratchBuffer.reserve(block->DecompressedSize);
1331 if (!UopDecompressBlock(block, scratchBuffer.data(), direction.FileIndex))
1332 {
1333 return;
1334 }
1335 // FIXME: CFileManager SHOULD not be a DataReader! In fact, no class need to be. Clean up!
1336 SetData(scratchBuffer.data(), block->DecompressedSize);
1337 const auto _header = UopReadAnimationHeader();
1338 (void)_header;
1339 auto frame = UopReadAnimationFrame(); // read only first frame to get image dimensions
1340 Ptr = frame.DataStart + frame.PixelDataOffset + PALETTE_SIZE;
1341 auto frameInfo = (AnimationFrameInfo *)Ptr;
1342 result = *frameInfo;
1343 Move(sizeof(AnimationFrameInfo));
1344}
1345
1346inline bool
1347CFileManager::UopReadAnimationFrames(const AnimationState &anim, LoadPixelData16Cb pLoadFunc)

Callers

nothing calls this directly

Calls 3

UopDecompressBlockFunction · 0.85
reserveMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected