/******************************************
  netpuyo(client)
  netpuyo.h --- header of client program
  (C) Sep 17, 1997 ROYALPANDA
*******************************************/

#define NOTHING   -1
#define WALL      8
#define JAMA      0

typedef struct{
  int map_c[8][14];
  int map_s[8][14];
  int puyo[2];
  int next[4];
  int x[2];
  int y[2];
  int dir;
  int kill[13];
  int blink;
  int jama_line;
  int jama_top;
  int stock;
  int stock_next;
  int moving;
  int win;
} player_t;

extern unsigned char *DefaultResources[];

extern player_t P[2];
extern int My_id;

extern char *Myname;
extern int Sock;

int init_network( char *host, int port );
int recv_msg( void );
int recv_snum( void );
int recv_id( void );
int recv_lnum( void );
void send_init( int msg );
void send_snum( int i );
void send_id( int p );
void send_msg( void );

void init_game( void );
void animation( void );
void move( int d );
void rotate( int d );
int fall( void );
int turn( void );

void flush_scr( int p );
void move_puyo( int p );
int fall_puyo( int p );
int blink_puyo( int p );
void kill_puyo( int p );
int jama_puyo( int p );

void draw( int p, int x, int y );
void draw_pic( int p, int x, int y, int col, int sty );
void draw_next( int p );
void draw_stock( int p, int i );
void stock( int p );
void init_graph( char *g_dir, char **wall );
void clear_scrg(void);
void chat( void );

void message( int p, char *msg );
void set_timer( int i );
void reset_timer( int i );
void quit();
void winner( int p);
void start_move( void );

