1 /* $Header: /home/yav/catty/fkiss/RCS/fkiss.h,v 1.39 2000/09/28 07:51:48 yav Exp $
2  * fkiss global symbols
3  * written by yav <yav@bigfoot.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef _FKISS_H
21 #define _FKISS_H
22 
23 #ifndef _KISS_H
24 #include "kiss.h"
25 #endif
26 
27 #ifndef MAXCOL
28 #define MAXCOL KISSGS4_MAXCOL
29 #endif
30 
31 #ifndef MAXCEL
32 #if (KISSGS4_MAXCEL < 4096)
33 #define MAXCEL 4096		/* <= Maximum value of signed short */
34 #else
35 #define MAXCEL KISSGS4_MAXCEL
36 #endif
37 #endif
38 
39 #ifndef MAXOBJ
40 #define MAXOBJ MAXCEL		/* <= Maximum value of signed short */
41 #endif
42 
43 /* System pixel number */
44 #define SPX_BG	0		/* Background */
45 #define SPX_FG	1		/* Foreground */
46 #define SPX_BG2	2		/* Light background */
47 #define SPX_MN	3		/* Menu background */
48 #define SPX_BT	4		/* Button background */
49 #define SPX_MAX	5
50 
51 /* System GC number */
52 #define SGC_GEN	0		/* generic */
53 #define SGC_MN	1		/* menu */
54 #define SGC_BT0	2		/* normal menu button */
55 #define SGC_BT1	3		/* reversed menu button */
56 #define SGC_IN0	4
57 #define SGC_IN1	5
58 #define SGC_T8	6		/* ASCII data comment */
59 #define SGC_T16	7		/* Japanese KANJI data comment */
60 #define SGC_MAX	8
61 
62 typedef struct {
63   short x;
64   short y;
65   short w;
66   short h;
67 } AREA;
68 
69 /* Menu Window structure */
70 typedef struct {
71   short n;			/* index number 0,1,2... -1(End) */
72   short st;			/* menu status */
73   short w;			/* width */
74   short h;			/* height */
75   Window win;			/* Window ID */
76 } MW;
77 
78 typedef struct {
79   int n;			/* cell or object no. */
80   int s;			/* hit status (0:No, other:Hit) */
81 } HITP;
82 
83 /* data structure */
84 typedef struct {
85   unsigned char *image;
86   long *iline;
87   Pixmap pixmap;
88   Pixmap clip;
89   Pixmap transclip;
90   GC gc;
91   char *filename;
92   char *comment;
93   short orgw;			/* original width */
94   short orgh;			/* original height */
95   short orgx;			/* original offset-x */
96   short orgy;			/* original offset-y */
97   short width;			/* optimized width */
98   short height;			/* optimized height */
99   short ofsx;			/* optimized offset-x */
100   short ofsy;			/* optimized offset-y */
101   short obj;
102   short fix;
103   short transparency;		/* 0:Solid 128:Half 256:Transparent */
104   int colfile;
105   int pixpal;
106   char setflag[MAXSET];		/* 0:no use 1:active */
107   char unmap;			/* 0:mapped 1:unmapped */
108   short line;			/* line number described in *.cnf */
109   short bpp;			/* bit per pixel */
110   int hitn;			/* hit check cell number */
111   HITP *hitp;			/* hit check cell list */
112 } CELL;
113 
114 typedef struct {
115   unsigned char r;
116   unsigned char g;
117   unsigned char b;
118 } KISSCOLOR;
119 
120 typedef struct {
121   short bpc;			/* bit per color */
122   short cpg;			/* color per palette group */
123   short pg;			/* number of palette group */
124   char *filename;
125 } COLOR;
126 
127 typedef struct {
128   short width;
129   short height;
130   short fix;
131   short pesi;
132   short ncel;			/* 0 ... MAXCEL */
133   int ohitn;			/* hit check obj number */
134   HITP *ohitp;			/* hit check obj list */
135 } OBJECT;
136 
137 typedef struct {
138   short x;
139   short y;
140   short ox;			/* original position-x (specified in cnf) */
141   short oy;			/* original position-y (specified in cnf) */
142 } OBJPOS;
143 
144 typedef struct {
145   short pal;
146   OBJPOS *obj;
147 } SETINFO;
148 
149 
150 /* KISS event code */
151 #define BIT_EVENT	0x100
152 #define BIT_ACTION	0x200
153 
154 #define EVE_top		BIT_EVENT
155 #define EVE_NEVER		(EVE_top+0)
156 #define EVE_INITIALIZE		(EVE_top+1)
157 #define EVE_ALARM		(EVE_top+2)
158 #define EVE_BEGIN		(EVE_top+3)
159 #define EVE_END			(EVE_top+4)
160 #define EVE_PRESS		(EVE_top+5)
161 #define EVE_RELEASE		(EVE_top+6)
162 #define EVE_CATCH		(EVE_top+7)
163 #define EVE_DROP		(EVE_top+8)
164 #define EVE_FIXCATCH		(EVE_top+9)
165 #define EVE_FIXDROP		(EVE_top+10)
166 #define EVE_UNFIX		(EVE_top+11)
167 #define EVE_SET			(EVE_top+12)
168 #define EVE_COL			(EVE_top+13)
169 #define EVE_IN			(EVE_top+14)
170 #define EVE_OUT			(EVE_top+15)
171 #define EVE_STILLIN		(EVE_top+16)
172 #define EVE_STILLOUT		(EVE_top+17)
173 #define EVE_COLLIDE		(EVE_top+18)
174 #define EVE_APART		(EVE_top+19)
175 #define EVE_VERSION		(EVE_top+20)
176 
177 #define ACT_top		BIT_ACTION+21
178 #define ACT_NOP			(ACT_top+0)
179 #define ACT_DEBUG		(ACT_top+1)
180 #define ACT_SHELL		(ACT_top+2)
181 #define ACT_UNMAP		(ACT_top+3)
182 #define ACT_MAP			(ACT_top+4)
183 #define ACT_ALTMAP		(ACT_top+5)
184 #define ACT_MOVE		(ACT_top+6)
185 #define ACT_SOUND		(ACT_top+7)
186 #define ACT_TIMER		(ACT_top+8)
187 #define ACT_RANDOMTIMER		(ACT_top+9)
188 #define ACT_QUIT		(ACT_top+10)
189 #define ACT_CHANGESET		(ACT_top+11)
190 #define ACT_CHANGECOL		(ACT_top+12)
191 #define ACT_TRANSPARENT		(ACT_top+13)
192 #define ACT_WINDOWSIZE		(ACT_top+14)
193 #define ACT_VIEWPORT		(ACT_top+15)
194 #define ACT_IFFIXED		(ACT_top+16)
195 #define ACT_IFNOTFIXED		(ACT_top+17)
196 #define ACT_IFMAPPED		(ACT_top+18)
197 #define ACT_IFNOTMAPPED		(ACT_top+19)
198 #define ACT_IFMOVED		(ACT_top+20)
199 #define ACT_IFNOTMOVED		(ACT_top+21)
200 #define ACT_SETFIX		(ACT_top+22)
201 #define ACT_MOVEBYX		(ACT_top+23)
202 #define ACT_MOVEBYY		(ACT_top+24)
203 #define ACT_MOVETO		(ACT_top+25)
204 #define ACT_MOVERANDX		(ACT_top+26)
205 #define ACT_MOVERANDY		(ACT_top+27)
206 #define ACT_MOVETORAND		(ACT_top+28)
207 #define ACT_MUSIC		(ACT_top+29)
208 #define ACT_NOTIFY		(ACT_top+30)
209 
210 
211 /* event handler result code */
212 #define ACTBIT_SOUND	1	/* sound playing status changed */
213 #define ACTBIT_MAP	2	/* cell mapping status changed */
214 
215 typedef struct {
216   int objn;
217   int objx;
218   int objy;
219 } EVHITWK;
220 
221 /* Japanese text coding type */
222 #define CODING_UNKNOWN	0
223 #define CODING_SJIS	1
224 #define CODING_EUC	2
225 #define CODING_JIS	3
226 #define CODING_MAX	4	/* number of coding types */
227 
228 typedef struct {
229   char *buf;			/* buffer */
230   int len;			/* alloced length */
231   int n;			/* current ptr (buf[n] '\0') */
232 } LSTR;
233 
234 
235 #endif /* _FKISS_H */
236 
237 /* End of file */
238