#ifndef PIXMAP_H
#define PIXMAP_H

#ifdef E
#undef E
#endif

#ifdef PIXMAP
#define E
#else
#define E extern
#endif

#define SP		58
#define NONE		 0
#define WALL		 1
#define COSMO		 2
#define COSMO1		 3
#define COSMO2		 4
#define COSMO3		 5
#define COSMO4		 6
#define COSMO5		 7
#define BLOCK		 8
#define BLOCK_BW	 9
#define BALL_L		10
#define BALL_R		11
#define BALL		12
#define BALL_L_BW	13
#define BALL_R_BW	14
#define PA		15
#define STAR		16
#define STAR_BW		17
#define CURTAIN1	18
#define CURTAIN2	19
#define CURTAIN3	20
#define CURTAIN4	21
#define CURTAIN5	22
#define CURTAIN6	23
#define CURTAIN7	24
#define CURTAIN8	25
#define B0		26
#define B1		27
#define B2		28
#define B3		29
#define B4		30
#define B5		31
#define B6		32
#define B7		33
#define B8		34
#define B9		35
#define S0		36
#define S1		37
#define S2		38
#define S3		39
#define S4		40
#define S5		41
#define S6		42
#define S7		43
#define S8		44
#define S9		45
#define Sx		46
#define SCORE		47
#define D0		48
#define D1		49
#define D2		50
#define D3		51
#define D4		52
#define D5		53
#define D6		54
#define D7		55
#define D8		56
#define D9		57

#define MAXTMP		128
#define TMP_WIDTH	MAXTMP*SIZE

typedef struct {
  int x;
  int y;
  int width;
  int height;
} Chara_struct;

typedef struct {
  int tx,ty;
  int x,y;
  int width,height;
  Window win;
} Position;

typedef struct {
  int stack[MAXTMP];
  int index;
} Stack;

E Chara_struct sp[SP];
E Position sppos[MAXTMP];
E Stack tmp_stack;


/* macros */
#define place_chara(WIN,C,X,Y)\
{\
  XCopyArea(disp, mask,WIN,\
	    and_gc,sp[C].x,sp[C].y,sp[C].width,sp[C].height,X,Y);\
  XCopyArea(disp,chara,WIN,\
	     or_gc,sp[C].x,sp[C].y,sp[C].width,sp[C].height,X,Y);\
\
}
#define init_stack(ST) (ST)->index=0
#define push(ST,N) (ST)->stack[((ST)->index)++]=(N)
#define pop(ST) ((ST)->index==0 ? -1 : (ST)->stack[--((ST)->index)])

/* Functions */
E int get_fs( char *file_name );
E void make_default_bg();
E void load_image();
E void set_charas();
E void make_pixmaps();
E void init_tmp();
E int  put_sp(Window win,int c,int x,int y,int ty);
E void return_back(int n);

#endif
