1 /*
2  * XPilot NG, a multiplayer space war game.
3  *
4  * Copyright (C) 1991-2001 by
5  *
6  *      Bj�rn Stabell        <bjoern@xpilot.org>
7  *      Ken Ronny Schouten   <ken@xpilot.org>
8  *      Bert Gijsbers        <bert@xpilot.org>
9  *      Dick Balaska         <dick@xpilot.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25 
26 #ifndef	BITMAPS_H
27 #define	BITMAPS_H
28 
29 #include "gfx2d.h"
30 #include "types.h"
31 
32 #define BM_HOLDER_FRIEND 0
33 #define BM_HOLDER_ENEMY  1
34 #define BM_BALL		 2
35 #define BM_SHIP_SELF	 3
36 #define BM_SHIP_FRIEND	 4
37 #define BM_SHIP_ENEMY	 5
38 #define BM_BULLET	 6
39 #define BM_BULLET_OWN	 7
40 #define BM_BASE_DOWN	 8
41 #define BM_BASE_LEFT	 9
42 #define BM_BASE_UP	10
43 #define BM_BASE_RIGHT	11
44 #define BM_FUELCELL	12
45 #define BM_FUEL		13
46 #define BM_ALL_ITEMS	14
47 #define BM_CANNON_DOWN  15
48 #define BM_CANNON_LEFT  16
49 #define BM_CANNON_UP	17
50 #define BM_CANNON_RIGHT 18
51 #define BM_SPARKS	19
52 #define BM_PAUSED	20
53 #define BM_WALL_TOP	21
54 #define BM_WALL_LEFT	22
55 #define BM_WALL_BOTTOM	23
56 #define BM_WALL_RIGHT	24
57 #define BM_WALL_LU	25
58 #define BM_WALL_RU	26
59 #define BM_WALL_LD	27
60 #define BM_WALL_RD	28
61 
62 #define BM_WALL_FILLED  29
63 #define BM_WALL_UR	30
64 #define BM_WALL_UL	31
65 
66 #define BM_SCORE_BG	32
67 #define BM_LOGO		33
68 #define BM_REFUEL	34
69 #define BM_WORMHOLE	35
70 #define BM_MINE_TEAM    36
71 #define BM_MINE_OTHER	37
72 #define BM_CONCENTRATOR 38
73 #define BM_PLUSGRAVITY  39
74 #define BM_MINUSGRAVITY 40
75 #define BM_CHECKPOINT	41
76 #define BM_METER	42
77 #define BM_ASTEROIDCONC	43
78 #define BM_BALL_GRAY    44
79 
80 #define NUM_OBJECT_BITMAPS 45
81 #define NUM_BITMAPS	45
82 
83 #define BMS_UNINITIALIZED 0
84 #define BMS_INITIALIZED 1
85 #define BMS_READY 2
86 #define BMS_ERROR -1
87 
88 #define BG_IMAGE_HEIGHT 442
89 #define LOGO_HEIGHT     223
90 
91 #define RADAR_TEXTURE_SIZE 32
92 
93 typedef struct {
94     Pixmap		bitmap;
95     Pixmap		mask;
96     bbox_t		bbox;
97     int                 rgb; /* the color this image is blended with */
98 } xp_bitmap_t;
99 
100 /* xp_pixmap_t holds all data related to one "logical" image.
101  * One logical image can consists of several rectangular pixel
102  * arrays (physical images). All physical images share the same
103  * overall dimensions.
104  *
105  * Note: if the count is negative it means that the other images
106  * are rotated copies of the original image.
107  */
108 typedef struct {
109     const char		*filename;     /* the file containing the image */
110     int			count;         /* amount of images (see above) */
111     int			state;         /* the state of the image (BMS_*) */
112     unsigned		width, height; /* the (scaled) dimensions */
113     bool		scalable;      /* should this image be scaled */
114     xp_bitmap_t		*bitmaps;      /* platform dependent image data */
115     xp_picture_t	picture;       /* the image data in RGB format */
116 } xp_pixmap_t;
117 
118 extern xp_pixmap_t *pixmaps;
119 extern int num_pixmaps, max_pixmaps;
120 extern xp_pixmap_t xp_pixmaps[];
121 
122 int Bitmaps_init(void);
123 void Bitmaps_cleanup(void);
124 int Bitmap_create (Drawable d, int img);
125 void Bitmap_update_scale (void);
126 
127 xp_bitmap_t *Bitmap_get (Drawable d, int img, int bmp);
128 void Bitmap_paint (Drawable d, int img, int x, int y, int bmp);
129 void Bitmap_paint_area (Drawable d, xp_bitmap_t *bit, int x, int y, irec_t *r);
130 xp_bitmap_t *Bitmap_get_blended(Drawable d, int img, int rgb);
131 void Bitmap_paint_blended(Drawable d, int img, int x, int y, int rgb);
132 
133 #endif
134