Skip to content

Instantly share code, notes, and snippets.

@kolen
Last active November 16, 2018 10:22
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/2ece70493ba5d9510db01823bb6ac78e to your computer and use it in GitHub Desktop.
Save kolen/2ece70493ba5d9510db01823bb6ac78e to your computer and use it in GitHub Desktop.
# based on https://github.com/saniv/sau/blob/master/src/fmt_spr.c
meta:
id: magic_and_mayhem_sprite
file-extension: spr
application: Magic & Mayhem
endian: le
seq:
- id: magic
contents: "SPR\0"
- id: file_size
type: s4
- id: u1
type: s4
- id: num_frames
type: s4
- id: num_pallettes
type: s4
- id: u2
type: s4
- id: pallettes
type: pallette
repeat: expr
repeat-expr: num_pallettes
- id: frame_offsets
type: u4le
repeat: expr
repeat-expr: num_frames
- id: frames
type: frames
size-eos: true
types:
pallette_color:
seq:
- id: r
type: u1
- id: g
type: u1
- id: b
type: u1
pallette:
seq:
- id: colors
type: pallette_color
repeat: expr
repeat-expr: 256
frames:
seq:
- id: frames
type: frame(_index)
repeat: expr
repeat-expr: _root.num_frames
frame:
params:
- id: idx
type: u4
instances:
frame:
pos: _root.frame_offsets[idx]
type: frame_header
size-eos: true
frame_header:
seq:
- id: size
type: u4
- id: width
type: u4
- id: height
type: u4
- id: origin_x
type: s4
- id: origin_y
type: s4
- id: name
type: str
size: 8
encoding: ascii
- id: pallette_number
type: u4
- id: unknown1
type: u4
- id: unknown2
type: u4
- id: lines
type: line
repeat: expr
repeat-expr: height
line:
seq:
- id: deltas_offset
type: u4
- id: pixels_offset
type: u4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment