#ifndef GAMEBOARDCLASS_H
#define GAMEBOARDCLASS_H

#include "graphics_support.h"
#include <intuition/classes.h>
#include <utility/tagitem.h>
#include <clib/utility_protos.h>
#include <libraries/mui.h>

enum {red_player, yellow_player};
enum {MUIA_Gameboard_Currentplayer=TAG_USER, MUIA_Gameboard_Inputactive,
      MUIA_Gameboard_Winner, MUIA_Gameboard_Restart, MUIA_Gameboard_Tiegame};

/*                   capabilites [ISG]
**
** MUIA_Gameboard_Currentplayer  [.S.]
** MUIA_Gameboard_Inputactive    [.S.]
** MUIA_Gameboard_Winner         [.S.]
** MUIA_Gameboard_Restart        [.S.]
** MUIA_Gameboard_Tiegame        [.S.]
**
*/

struct gameboarddata
{
    // Red piece
    UBYTE *red_body;
    ULONG *red_palette;
    struct BitMap *red_bitmap;
    ULONG red_width, red_height;
    ULONG red_depth;

    // Yellow piece
    UBYTE *yellow_body;
    ULONG *yellow_palette;
    struct BitMap *yellow_bitmap;
    ULONG yellow_width, yellow_height;
    ULONG yellow_depth;

    // Mask
    struct BitMap *mask_bitmap;

    // Blank square
    ULONG blank_palette[6];
    struct BitMap *blank_bitmap;
    ULONG blank_width, blank_height;
    ULONG blank_depth;

    struct pen pens[32];

    BOOL inputactive;
    BOOL restartgameboard;

    char current_player;    // May be 0 (red) or 1 (yellow)
    int counterx, countery; // Exact window co-ordinates to place piece
    int column, row;        // Column and Row that a piece was placed in

    char filled[7][5];      // 2D array records which holes in the board are filled
                            // NB: -1 denotes an empty hole
    char columntop[7];      // stores a number from 0->4 for each column to say which piece is topmost
                            // NB: -1 denotes a completely empty column i.e. no topmost piece

    char winning_player;    // May be 0 (red) or 1 (yellow)
    BOOL tiegame;
};


__saveds ULONG gameboardDispatcher (__reg("a0") struct IClass *cl,
                                    __reg("a2") Object *obj,
                                    __reg("a1") Msg msg);

#endif

