File: isrefs.h

package info (click to toggle)
yiff 2.06-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 3,464 kB
  • ctags: 3,028
  • sloc: ansic: 47,463; makefile: 218; sh: 77
file content (227 lines) | stat: -rw-r--r-- 4,990 bytes parent folder | download | duplicates (3)
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
/*
                              XSW Image Sets

	Image set referances (abbriviated isref) used by the
	client to display objects on the view screen.

 */


#ifndef ISREFS_H
#define ISREFS_H

#include <db.h>
#include <sys/types.h>
 

/*
 *      Maximum isrefs per client.
 */
#define ISREF_MAX               500

/*
 *	Maximum frames per isref.
 */
#define ISREF_FRAMES_MAX	16


/*
 *	Option flags:
 */
#define ISREF_OPT_HAS_TRANSPARENCY	(1 << 2)
#define ISREF_OPT_NO_IMAGE		(1 << 3)
#define ISREF_OPT_STAY_LOADED		(1 << 4)


/*
 *	Special isref numbers:
 *
 *	These numbers are for special isrefs that
 *	are handled differently.
 */
#define ISREF_DEFAULT			0
/*
 *	Isrefs 10 to 19 are for stream weapons.
 *	Note: No graphical images are used for these isrefs.
 */
#define ISREF_STREAMWEAPON_YELLOW	10
#define ISREF_STREAMWEAPON_GREEN	11
#define ISREF_STREAMWEAPON_PURPLE	12
#define ISREF_STREAMWEAPON_ORANGE	13
/*
 *	Isrefs 20 to 29 are for special effects (such as explosions).
 */
#define ISREF_EXPLOSION_LARGE		20
#define ISREF_EXPLOSION_SMALL		21


/*
 *	Image format codes:
 */
#define ISREF_FORMAT_CODE_UNKNOWN	0
#define ISREF_FORMAT_CODE_TGA		1


/*
 *	Load progress codes:
 */
#define ISREF_LOAD_PROGRESS_DONE 	0
#define ISREF_LOAD_PROGRESS_LOADING	1


/*
 *	Merge modes:
 *
 *	Determines the mathimatical operation applied to the
 *	isref being blitted on to the buffer.
 */
#define ISREF_MERGE_NORMAL	0
#define ISREF_MERGE_ADDITIVE	1
#define ISREF_MERGE_SUBTRACTIVE	2
#define ISREF_MERGE_MIRAGE	3
#define ISREF_MERGE_MULTIPLY	4

/*
 *	Has transparency:
 *
 *	If an isref has transparency set to ISREF_HASTRANSPARENT, the
 *	blitting functions will check for transparent pixel
 *	r = 0x00, g = 0x00, and b = 0x00.
 *
 *	This will help to boost blitting speed by not checking transparency
 *	on isrefs that don't intend to have transparency.
 */
#define ISREF_NOTRANSPARENT	0
#define ISREF_HASTRANSPARENT	1

/* 
 *	Frame determinat:
 *
 *	Determines how and where the frame number will be
 *	calculated from.
 */
#define ISREF_FDETERMINE_BY_HEADING	0
#define ISREF_FDETERMINE_BY_ANIMATION	1

/*
 *	Layer Placement
 *
 *      These are codes for determining the value for the member
 *      layer_placement of the isref_struct.
 *
 *	When an isref's layer_placement is set to any of the
 *	background codes then it will be visible as long as
 *	the 'viewport' is within it's size.
 */
#define ISREF_LAYER_FG		0	/* Normal object in foreground. */
#define ISREF_LAYER_BG_TILED	1
#define ISREF_LAYER_BG_STATIC	2

/*
 *	Special effects:
 *
 *      These are codes for determining the value for the member
 *      effects of the isref_struct.
 */
#define	ISREF_EFFECTS_STARGLOW		(1 << 1)
#define ISREF_EFFECTS_FADEINGLOW	(1 << 2)
#define ISREF_EFFECTS_FADEOUTGLOW	(1 << 3)



/*
 *	Data types:
 */
typedef u_int64_t	isref_options_mask_t;
typedef u_int64_t	isref_effects_mask_t;


/*
 *	Point light structure:
 *
 *	Used for drawing vector, hazard, and strobe lights.
 *
 *	Point lights should be drawn after the image is blitted.
 *
 *	The angle theta is relative to the object's north, not
 *	the galactic core north.
 */
typedef struct {

	/* Relative position. */
	double theta;		/* Bearing angle from object center. */
	double radius;		/* In Screen units. */

	/* Color. */
	u_int8_t a, r, g, b;

	/* Strobe intervals, set all to 0 for no strobing. */
	char	strobe_state;		/* True = on, False = off. */
	long	strobe_off_int,		/* In milliseconds. */
		strobe_on_int,		/* In milliseconds. */
		strobe_next;		/* In milliseconds. */

} isref_point_light_struct;


/*
 *	ISRef core structure:
 */
typedef struct {

	char *filename;		/* Absolute path to the image file. */

        int load_progress;	/* One of ISREF_LOAD_PROGRESS_*. */

	/* Options. */
	isref_options_mask_t option;

	/* Calculation methoids. */
	int merge_mode;		/* One of ISREF_MERGE_*. */
	int frame_determinant;	/* One of ISREF_FDETERMINE_*. */
	int layer_placement;	/* One of ISREF_LAYER_*. */
	isref_effects_mask_t effects;	/* Special effects. */

	double magnification;	/* Magnification, must be 1 or greater. */


	/* Size and frame attributes. */
	unsigned int total_frames;

	unsigned int	width,	/* Total width and height. */
			height;

	unsigned int	fwidth,	/* Frame width and height. */
			fheight;


	/*   Allocated structure containing image library data.
	 *   Pointer type determined by format_code.
	 *   This must be freed after calling library structure destroy
	 *   routine (as only it's substructures are deallocated by
	 *   library routine).
	 */
	void *lib_data;

	/* Format code for member lib_data, One of ISREF_FORMAT_CODE_*. */
        int format_code;


 	/*   Pointer to image data in lib_data, do not free this!
	 *   The call to the image library function will do that.
	 */
	u_int8_t *image_data;


	/* Point lights. */
	isref_point_light_struct **point_light;
	int total_point_lights;

} isref_struct;
extern isref_struct **isref;

extern long total_isrefs;



#endif /* ISREFS_H */