Skip to content

Instantly share code, notes, and snippets.

@kolen
Last active May 14, 2017 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kolen/55e0985126b67bbfcad2acf2f3f13918 to your computer and use it in GitHub Desktop.
Save kolen/55e0985126b67bbfcad2acf2f3f13918 to your computer and use it in GitHub Desktop.
File format for katai (katai.io)
meta:
id: magic_and_mayhem_spr
application: Magic & Mayhem
file-extension: spr
endian: le
seq:
- id: header
type: header
- id: pallettes
size: 256 * 3
repeat: expr
repeat-expr: header.num_pallettes
- id: frames
size-eos: true
type: frames
types:
header:
seq:
- id: magic
contents: "SPR\0"
- id: size
type: s4
- id: spr_type
type: u4
enum: spr_type
- id: num_frames
type: u4
- id: num_pallettes
type: u4
- id: unknown_2
type: u4
frames:
seq:
- id: frame_offsets
type: frame_entry
repeat: expr
repeat-expr: _root.header.num_frames
instances:
frame_offsets_size:
value: 4 * _root.header.num_frames
frame:
seq:
- id: size
type: u4
- id: width
type: u4
- id: height
type: u4
- id: center_x
type: s4
- id: center_y
type: s4
- id: name
type: str
encoding: ascii
size: 8
- id: pallette_id
type: u4
- id: unknown_1
type: u4
- id: unknown_2
type: u4
- id: pixels
type: pixels
size: size
pixels:
seq:
- id: lines
type: line
repeat: expr
repeat-expr: _parent.height
line:
seq:
- id: offset_deltas
type: u4
- id: offset_pixels
type: u4
instances:
deltas:
size-eos: true
pos: offset_deltas
pixels:
size-eos: true
pos: offset_pixels
frame_entry:
seq:
- id: offset
type: u4
instances:
sprite:
pos: offset + _parent.frame_offsets_size
type: frame
enums:
spr_type:
0x4: standard # all creatures and tilesets
0x2: special # interf64.spr LOGO.spr magico64.spr magico80.spr
# overlay.spr scanner.spr Scrollbutt.spr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment