Skip to content

Commit

Permalink
feat: force same width and height on frames
Browse files Browse the repository at this point in the history
  • Loading branch information
jgabaut committed Feb 1, 2025
1 parent 22791ac commit d130ca2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion s4c/core/sheet_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,19 @@ def convert_spritesheet(mode, filename, s: SheetArgs, *args):
print(f"\n\n[ERROR] at sprite #{len(target_sprites)}: palette mismatch\n")
print(f"\texpected: {target_sprites[0][3]}")
print(f"\tfound: {rgb_palette}\n")
print("You must have all frames using the same palette.\n")
print("All frames must use the same palette.\n")
return False
if sprite.size[0] != target_sprites[0][1]: #Must have same width as first sprite
print(f"\n\n[ERROR] at sprite #{len(target_sprites)}: width mismatch\n")
print(f"\texpected: {target_sprites[0][1]}")
print(f"\tfound: {sprite.size[0]}\n")
print("All frames must have the same width.\n")
return False
if sprite.size[1] != target_sprites[0][2]: #Must have same height as first sprite
print(f"\n\n[ERROR] at sprite #{len(target_sprites)}: height mismatch\n")
print(f"\texpected: {target_sprites[0][2]}")
print(f"\tfound: {sprite.size[1]}\n")
print("All frames must have the same height.\n")
return False

target_sprites.append([chars, sprite.size[0], sprite.size[1],
Expand Down
14 changes: 13 additions & 1 deletion s4c/core/sprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,19 @@ def print_converted_sprites(mode, direc, *args):
print(f"\n\n[ERROR] at file #{idx}: {file}: palette mismatch\n")
print(f"\texpected: {target_sprites[0][3]}")
print(f"\tfound: {rbg_palette}\n")
print("You must have all frames using the same palette.\n")
print("All frames must use the same palette.\n")
return False
if frame_width != target_sprites[0][1]: #Must have same width as first sprite
print(f"\n\n[ERROR] at file #{idx}: {file}: width mismatch\n")
print(f"\texpected: {target_sprites[0][1]}")
print(f"\tfound: {frame_width}\n")
print("All frames must have the same width.\n")
return False
if frame_height != target_sprites[0][2]: #Must have same height as first sprite
print(f"\n\n[ERROR] at file #{idx}: {file}: height mismatch\n")
print(f"\texpected: {target_sprites[0][2]}")
print(f"\tfound: {frame_height}\n")
print("All frames must have the same height.\n")
return False
target_sprites.append([conv_chars, frame_width, frame_height,
rbg_palette, palette_size])
Expand Down

0 comments on commit d130ca2

Please sign in to comment.