File: sact.h

package info (click to toggle)
xsystem35 1.7.3-pre5-8
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 7,372 kB
  • sloc: ansic: 51,007; sh: 12,049; asm: 863; makefile: 412; xml: 281; perl: 142
file content (310 lines) | stat: -rw-r--r-- 6,864 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/*
 * sact.h: SACT
 *
 * Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
 *               1998-                           <masaki-c@is.aist-nara.ac.jp>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
*/
/* $Id: sact.h,v 1.3 2003/07/14 16:22:51 chikama Exp $ */

#ifndef __SACT_H__
#define __SACT_H__

#include "config.h"

#include <glib.h>
#include "portab.h"
#include "graphics.h"
#include "surface.h"
#include "sacttimer.h"
#include "variable.h"


// ץ饤Ȥκ
#define SPRITEMAX 21845

// CGκ
#define CGMAX 63336

// åκĹ
#define MSGBUFMAX 257*10

// κǿ
#define SEL_ELEMENT_MAX 20


// Ȥμ
#define KEYWAIT_NONE 0
#define KEYWAIT_SIMPLE 1
#define KEYWAIT_SPRITE 2
#define KEYWAIT_MESSAGE 3
#define KEYWAIT_SELECT 4
#define KEYWAIT_BACKLOG 5

// ʸִ
typedef struct {
	char *src; // ֤ʸ
	char *dst; // ֤ʸ
} strexchange_t;

// SACTEFAM Ȥäޥ
typedef struct {
	int fd;       // SACTEFAM.KLD Υեǥץ꥿
	char *mapadr; // mmap 줿ǽΥɥ쥹
	off_t size;   // mmap 礭
	int datanum;  // SACTEFAM.KLD Υޥեο
	int *no;      // ʥꥪ¦Ǥֹ
	int *offset;  // ǡؤΥեå
} SACTEFAM_t;


// CG_XX ǺCGμ
enum cgtype {
	CG_NOTUSED = 0,
	CG_LINKED  = 1,
	CG_SET     = 2,
	CG_REVERSE = 3,
	CG_STRETCH = 4
};

// cg˴ؤ
struct _cginfo {
	enum cgtype type;  // CGμ, 0: ̤, 1:󥯤Ƥ, ...
	int no;            // CGֹ
	surface_t *sf;     // CG
	int refcnt;        // ȥ󥿡ˤʤä鳫Ƥ褤
};
typedef struct _cginfo cginfo_t;

// ץ饤ȤΥ
enum spritetype {
	SPRITE_NORMAL = 0,
	SPRITE_SWITCH = 1,
	SPRITE_GETA   = 2,
	SPRITE_GETB   = 3,
	SPRITE_PUT    = 4,
	SPRITE_ANIME  = 5,
	SPRITE_SWPUT  = 6,
	SPRITE_MSG    =100,
	SPRITE_WP,
	SPRITE_NONE   =-1
};

// ()
struct _sprite;

// ץ饤Ȥ˴ؤƼ
struct _sprite {
	// ץ饤ȤΥ
	enum spritetype type;
	
	// ץ饤ֹ
	int no;
	
	// 줾ξ֤λĤ餹ֹ
	int numsound1, numsound2, numsound3;
	
	//  sprite 礭(cg1礭)
	MyDimension cursize;
	
	// 줾ξ֤ɽ CG
	cginfo_t *cg1, *cg2, *cg3;
	
	// update Ȥɽcg
	cginfo_t *curcg;
	
	// ץ饤Ȥɽ뤫
	boolean show;
	boolean show_save; // Zkey hide save
	
	// ɽݤΥ֥Ψ 0:ʤ, 255: ̾ɽ
	int blendrate; 
	
	// ץ饤Ȥ Freeze Ƥ뤫(0:No 1-3: ֹ)
	int freezed_state;
	
	// ɽ (SetPos)
	MyPoint loc;
	
	// ߤΥץ饤Ȥɽ
	MyPoint cur;
	
	// event callback
	int (* eventcb)(struct _sprite *sp, agsevent_t *e);  // for key/mouse
	int (* teventcb)(struct _sprite *sp, agsevent_t *e); // for timer
        // sprite callback
	void (* remove)(struct _sprite *sp);
	// sprite褹Ȥ callback
	int  (* update)(struct _sprite *sp);
	
	boolean focused; // forcusƤ뤫
	boolean pressed; // spriteǥޥƤ뤫
	
	GSList *expsp; // ץ饤ȤΥꥹ
	
	// move command ѥѥ᡼
	struct {
		MyPoint to;     // ư
		int time;       // ưλ
		int speed;      // ư®
		int starttime;  // ưϻ
		int endtime;    // ưλͽ
		boolean moving; // ư椫ɤ
	} move;
	
	// SACT.Numeralѥѥ᡼
	struct {
		int cg[10];
		MyPoint pos;
		int span;
	} numeral;
	
	// ץ饤Ȥμξ
	union {
		// åץ饤
		struct {
			
		} sw;
		
		// åȥץ饤
		struct {
			boolean dragging;  // ɥå
			MyPoint dragstart; // ɥåϰ
		} get;

		// ץåȥץ饤
		struct {
			
		} put;

		// ˥᡼󥹥ץ饤
		struct {
			int interval;      // ޤδֳ(10msec)
			int starttime;     // ϻ
			int npat;          // ˥ᥳ޿(1/2/3)
			unsigned int tick; // 
		} anime;
		
		// åץ饤
		struct {
			GSList    *buf;       // ɽʸΥꥹ
			surface_t *canvas;    // ʸ褹surface
			MyPoint    dspcur;    // ߤɽ
		} msg;
	} u;
};
typedef struct _sprite sprite_t;

// SACTΤξ
struct _sact {
	// SACTΥС
	int version;
	
	// ץ饤
	sprite_t *sp[SPRITEMAX];
	
	GSList *sp_zhide;  // ZǾäץ饤ȤΥꥹ
	GSList *sp_quake;  // Quakeɤ餹ץ饤ȤΥꥹ
	
	GSList *updatelist; // 褹륹ץ饤ȤΥꥹ
	
	cginfo_t *cg[CGMAX]; // cgޤCG_xxǺä CG
	
	// ɸϤθ
	MyPoint origin;
	
	// ʸ push/pop/replce 
	GSList *strstack;
	GSList *strreplace;
	char   *strreplacesrc;
	char   *strreplacedst; 
	
	// åץ饤ѥåХåե
	char msgbuf[MSGBUFMAX];
	char msgbuf2[MSGBUFMAX];
	
	// 򥦥
	struct {
		char *elem[SEL_ELEMENT_MAX]; // ʸ
		int spno; // طʥץ饤ֹ
		int font_size; // ʸ
		int font_type; // ե
		int frame_dot; // ȥץ饤Ȥγ¦Υԥ
		int linespace; // ιԴ
		int movecursor; // 
		int align; // Ԥ
		void (* cbmove)(agsevent_t *);
		void (* cbrelease)(agsevent_t *);
		surface_t   *charcanvas;
	} sel;
	
	// event listener
	GSList *eventlisteners;
	GSList *teventlisteners;
	GSList *teventremovelist;
	
	// MOVE륹ץ饤ȤΥꥹ
	GSList *movelist;
	int movestarttime; // Ƥ˰ư򳫻Ϥ뤿γϻ
	int movecurtime;
	
	MyRectangle updaterect; // ɬפspriteΰ
	
	// sact timer
	stimer_t timer[65536];
	
	// DnD˴ؤ
	sprite_t *draggedsp;  // dragΥץ饤
	boolean dropped;      // ץ饤Ȥɥåפ줿ɤ
	
	// keywaitμ
	int waittype;
	int waitkey;
	int sp_result_sw;
	int sp_result_get;
	int sp_result_put;
	
	// wait skip level
	//  0 ̾省Ԥ
	//  1 ɤΤߥå
	//  2 ̤ɤ⥹å
	int waitskiplv;
	
	// ϰϳ򥯥åȤβ
	int numsoundob;
	
	// depth map
	surface_t *dmap;
	
	// SACTEFAM.KLD
	SACTEFAM_t am;
	
	boolean zhiding;  // Zkeyˤ뱣
	int     zofftime;
	boolean zdooff;
	
	// Хå
	boolean logging;
	GList  *log;
};
typedef struct _sact sact_t;

// shortcut
#define sact sactprv
extern sact_t sact;

#endif /* __SACT_H__ */