#ifndef __MARINE_SPRITES_H__
#define __MARINE_SPRITES_H__

/*
 * Marine (player 2) sprite frames
 * Auto-generated by prepare_marine_sprites.py
 *
 * Total frames: 51
 * Frame size: 64x64 px (8x8 tiles)
 * Tiles per frame: 256 u32 words = 1024 bytes
 *
 * Frame layout:
 *   Walk: front 000,001,002,005 | front-left 006,007,008,011 | left 012-015 | back-left 018-020,023 | back 024-026,029 (mirror for right sides)
 *   Shoot: front 003,004 | front-left 009,010 | left 016,017 | back-left 021,022 | back 027,028
 *   Pain: 030 front-left, 031 front, 032 left, 033 back, 034 back-left (mirror 030,032,034 for right)
 *   Death: 035-041 (7 frames)
 *   Gibbed: 042-049 (8 frames)
 */

extern const unsigned int marine_000Tiles[256];
extern const unsigned int marine_001Tiles[256];
extern const unsigned int marine_002Tiles[256];
extern const unsigned int marine_003Tiles[256];
extern const unsigned int marine_004Tiles[256];
extern const unsigned int marine_005Tiles[256];
extern const unsigned int marine_006Tiles[256];
extern const unsigned int marine_007Tiles[256];
extern const unsigned int marine_008Tiles[256];
extern const unsigned int marine_009Tiles[256];
extern const unsigned int marine_010Tiles[256];
extern const unsigned int marine_011Tiles[256];
extern const unsigned int marine_012Tiles[256];
extern const unsigned int marine_013Tiles[256];
extern const unsigned int marine_014Tiles[256];
extern const unsigned int marine_015Tiles[256];
extern const unsigned int marine_016Tiles[256];
extern const unsigned int marine_017Tiles[256];
extern const unsigned int marine_018Tiles[256];
extern const unsigned int marine_019Tiles[256];
extern const unsigned int marine_020Tiles[256];
extern const unsigned int marine_021Tiles[256];
extern const unsigned int marine_022Tiles[256];
extern const unsigned int marine_023Tiles[256];
extern const unsigned int marine_024Tiles[256];
extern const unsigned int marine_025Tiles[256];
extern const unsigned int marine_026Tiles[256];
extern const unsigned int marine_027Tiles[256];
extern const unsigned int marine_028Tiles[256];
extern const unsigned int marine_029Tiles[256];
extern const unsigned int marine_030Tiles[256];
extern const unsigned int marine_031Tiles[256];
extern const unsigned int marine_032Tiles[256];
extern const unsigned int marine_033Tiles[256];
extern const unsigned int marine_034Tiles[256];
extern const unsigned int marine_035Tiles[256];
extern const unsigned int marine_036Tiles[256];
extern const unsigned int marine_037Tiles[256];
extern const unsigned int marine_038Tiles[256];
extern const unsigned int marine_039Tiles[256];
extern const unsigned int marine_040Tiles[256];
extern const unsigned int marine_041Tiles[256];
extern const unsigned int marine_042Tiles[256];
extern const unsigned int marine_043Tiles[256];
extern const unsigned int marine_044Tiles[256];
extern const unsigned int marine_045Tiles[256];
extern const unsigned int marine_046Tiles[256];
extern const unsigned int marine_047Tiles[256];
extern const unsigned int marine_048Tiles[256];
extern const unsigned int marine_049Tiles[256];
extern const unsigned int marine_050Tiles[256];

#define MARINE_FRAME_COUNT 51
#define MARINE_FRAME_BYTES 1024
#define MARINE_WALK_ANIM_FRAMES  4
#define MARINE_ATTACK_ANIM_FRAMES 2
#define MARINE_DEATH_FRAMES 7
#define MARINE_GIB_FRAMES 8

static const unsigned int* const MARINE_FRAMES[51] = {
    marine_000Tiles,
    marine_001Tiles,
    marine_002Tiles,
    marine_003Tiles,
    marine_004Tiles,
    marine_005Tiles,
    marine_006Tiles,
    marine_007Tiles,
    marine_008Tiles,
    marine_009Tiles,
    marine_010Tiles,
    marine_011Tiles,
    marine_012Tiles,
    marine_013Tiles,
    marine_014Tiles,
    marine_015Tiles,
    marine_016Tiles,
    marine_017Tiles,
    marine_018Tiles,
    marine_019Tiles,
    marine_020Tiles,
    marine_021Tiles,
    marine_022Tiles,
    marine_023Tiles,
    marine_024Tiles,
    marine_025Tiles,
    marine_026Tiles,
    marine_027Tiles,
    marine_028Tiles,
    marine_029Tiles,
    marine_030Tiles,
    marine_031Tiles,
    marine_032Tiles,
    marine_033Tiles,
    marine_034Tiles,
    marine_035Tiles,
    marine_036Tiles,
    marine_037Tiles,
    marine_038Tiles,
    marine_039Tiles,
    marine_040Tiles,
    marine_041Tiles,
    marine_042Tiles,
    marine_043Tiles,
    marine_044Tiles,
    marine_045Tiles,
    marine_046Tiles,
    marine_047Tiles,
    marine_048Tiles,
    marine_049Tiles,
    marine_050Tiles
};

/* Walk frames: [direction][pose] -> frame index */
static const u8 MARINE_WALK_FRAMES[8][4] = {
    {  0,  1,  2,  5},   /* dir 0: front */
    {  6,  7,  8, 11},   /* dir 1: front-left */
    { 12, 13, 14, 15},   /* dir 2: left */
    { 18, 19, 20, 23},   /* dir 3: back-left */
    { 24, 25, 26, 29},   /* dir 4: back */
    { 18, 19, 20, 23},   /* dir 5: back-right (mirror 3) */
    { 12, 13, 14, 15},   /* dir 6: right (mirror 2) */
    {  6,  7,  8, 11},   /* dir 7: front-right (mirror 1) */
};

/* Attack frames: [direction][pose] -> frame index */
static const u8 MARINE_ATTACK_FRAMES[8][2] = {
    { 3,  4},   /* dir 0: front */
    { 9, 10},   /* dir 1: front-left */
    {16, 17},   /* dir 2: left */
    {21, 22},   /* dir 3: back-left */
    {27, 28},   /* dir 4: back */
    {21, 22},   /* dir 5: back-right (mirror 3) */
    {16, 17},   /* dir 6: right (mirror 2) */
    { 9, 10},   /* dir 7: front-right (mirror 1) */
};

/* Pain frames: [direction] -> frame index (030 fl, 031 f, 032 l, 033 b, 034 bl; mirror for right) */
static const u8 MARINE_PAIN_FRAMES[8] = {31, 30, 32, 34, 33, 34, 32, 30};

/* Death frames: 035-041 (7 frames) */
static const u8 MARINE_DEATH_FRAMES_LUT[7] = {35, 36, 37, 38, 39, 40, 41};

/* Gibbed frames: 042-049 (8 frames, die by rocket etc.) */
static const u8 MARINE_GIB_FRAMES_LUT[8] = {42, 43, 44, 45, 46, 47, 48, 49};

#endif /* __MARINE_SPRITES_H__ */
