Skip to content

Commit

Permalink
Error message
Browse files Browse the repository at this point in the history
  • Loading branch information
grunt-lucas committed Sep 21, 2023
1 parent 74801d6 commit cfabe18
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,36 +828,36 @@ importCompiledAnimations(PtContext &ctx, const std::vector<std::vector<Animation
for (const auto &animPng : rawAnim) {
CompiledAnimFrame animFrame{animPng.frameName};

if (animPng.png.get_height() % TILE_SIDE_LENGTH != 0) {
if (animPng.png.get_width() % TILE_SIDE_LENGTH != 0) {
fatalerror(ctx.err, ctx.decompilerSrcPaths, ctx.decompilerConfig.mode,
fmt::format("anim '{}' frame '{}' height '{}' was not divisible by 8",
fmt::format("anim '{}' frame '{}' width '{}' was not divisible by 8",
fmt::styled(compiledAnim.animName, fmt::emphasis::bold),
fmt::styled(animFrame.frameName, fmt::emphasis::bold),
fmt::styled(animPng.png.get_height(), fmt::emphasis::bold)));
fmt::styled(animPng.png.get_width(), fmt::emphasis::bold)));
}
if (animPng.png.get_width() % TILE_SIDE_LENGTH != 0) {
if (animPng.png.get_height() % TILE_SIDE_LENGTH != 0) {
fatalerror(ctx.err, ctx.decompilerSrcPaths, ctx.decompilerConfig.mode,
fmt::format("anim '{}' frame '{}' width '{}' was not divisible by 8",
fmt::format("anim '{}' frame '{}' height '{}' was not divisible by 8",
fmt::styled(compiledAnim.animName, fmt::emphasis::bold),
fmt::styled(animFrame.frameName, fmt::emphasis::bold),
fmt::styled(animPng.png.get_width(), fmt::emphasis::bold)));
fmt::styled(animPng.png.get_height(), fmt::emphasis::bold)));
}

frameWidths.insert(animPng.png.get_width());
frameHeights.insert(animPng.png.get_height());
if (frameWidths.size() != 1) {
// TODO : fill in real error
throw std::runtime_error{"TODO : frameWidths.size() != 1"};
// fatalerror_animFrameDimensionsDoNotMatchOtherFrames(ctx.err, ctx.compilerSrcPaths, ctx.compilerConfig.mode,
// frame.animName, frame.frameName, "width",
// frame.png.get_width());
fatalerror(ctx.err, ctx.decompilerSrcPaths, ctx.decompilerConfig.mode,
fmt::format("anim '{}' frame '{}' width '{}' differed from previous frame width",
fmt::styled(compiledAnim.animName, fmt::emphasis::bold),
fmt::styled(animFrame.frameName, fmt::emphasis::bold),
fmt::styled(animPng.png.get_width(), fmt::emphasis::bold)));
}
if (frameHeights.size() != 1) {
// TODO : fill in real error
throw std::runtime_error{"TODO : frameHeights.size() != 1"};
// fatalerror_animFrameDimensionsDoNotMatchOtherFrames(ctx.err, ctx.compilerSrcPaths, ctx.compilerConfig.mode,
// frame.animName, frame.frameName, "height",
// frame.png.get_height());
fatalerror(ctx.err, ctx.decompilerSrcPaths, ctx.decompilerConfig.mode,
fmt::format("anim '{}' frame '{}' height '{}' differed from previous frame height",
fmt::styled(compiledAnim.animName, fmt::emphasis::bold),
fmt::styled(animFrame.frameName, fmt::emphasis::bold),
fmt::styled(animPng.png.get_height(), fmt::emphasis::bold)));
}

std::size_t pngWidthInTiles = animPng.png.get_width() / TILE_SIDE_LENGTH;
Expand Down

0 comments on commit cfabe18

Please sign in to comment.