Crusader_Decomp/rebuild/remorse/tests/shape_archive_tests.cpp
Maddo a76b071049 Enhance animation and control tests; improve rendering and shape loading validation
- Added tests for player animations in animation_archive_tests to ensure all animations are loaded correctly.
- Updated entity_dispatch_entry_tests to validate animation direction updates and added tests for sixteen-direction animations.
- Expanded isometric_controls_tests with comprehensive key event handling and action requests for various controller states.
- Improved map_renderer_tests by adding viewport rendering tests to compare unbounded and bounded views.
- Enhanced shape_archive_tests to validate shape frame loading and decoding consistency.
2026-10-07 00:18:08 +02:00

34 lines
1.2 KiB
C++

#include "remorse/file_system.h"
#include "remorse/shape_archive.h"
#include <cassert>
#include <filesystem>
int main()
{
const auto root = remorse::findGameDataRoot(std::filesystem::current_path());
assert(root.has_value());
const auto shapesPath = remorse::resolveGameDataPath(*root, std::filesystem::path("STATIC") / "SHAPES.FLX");
assert(shapesPath.has_value());
const auto archive = remorse::loadShapeArchive(*shapesPath);
assert(archive.has_value());
bool decodedFrame = false;
for (remorse::u32 shape = 0; shape < archive->archive.entryCount; ++shape) {
const auto frame = remorse::decodeShapeFrame(*archive, shape, 0);
if (frame && !frame->pixels.empty()) {
assert(frame->frame.width > 0);
assert(frame->frame.height > 0);
const auto parsedFrames = remorse::loadShapeFrames(*archive, shape);
assert(parsedFrames && !parsedFrames->empty());
const auto decodedFromParsed = remorse::decodeShapeFrame(parsedFrames->front());
assert(decodedFromParsed && decodedFromParsed->pixels == frame->pixels);
decodedFrame = true;
break;
}
}
assert(decodedFrame);
return 0;
}