Develop and Download Open Source Software

Browse CVS Repository

Contents of /mame32jp/mame32jp/src/tilemap.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download) (as text)
Wed Apr 24 03:53:21 2002 UTC (21 years, 11 months ago) by zero
Branch: MAIN
CVS Tags: ver_0_60_1, ver0_59_13, ver0_59_14, ver0_60_2, ver0_60_3, ver0_60_4, ver0_60_5, HEAD
Changes since 1.4: +0 -0 lines
File MIME type: text/x-chdr
*** empty log message ***

1 /* tilemap.h */
2
3 #ifndef TILEMAP_H
4 #define TILEMAP_H
5
6 struct tilemap; /* appease compiler */
7
8 #define ALL_TILEMAPS 0
9 /* ALL_TILEMAPS may be used with:
10 tilemap_set_flip, tilemap_mark_all_tiles_dirty
11 */
12
13 #define TILEMAP_OPAQUE 0x00
14 #define TILEMAP_TRANSPARENT 0x01
15 #define TILEMAP_SPLIT 0x02
16 #define TILEMAP_BITMASK 0x04
17 #define TILEMAP_TRANSPARENT_COLOR 0x08
18
19 /* Set transparency_pen to a mask. pen&mask determines whether each pixel is in front or back half */
20 #define TILEMAP_SPLIT_PENBIT 0x10
21 /*
22 TILEMAP_SPLIT should be used if the pixels from a single tile
23 can appear in more than one plane.
24
25 TILEMAP_BITMASK is used by Namco System1, Namco System2, NamcoNA1/2, Namco NB1
26 */
27
28 #define TILEMAP_IGNORE_TRANSPARENCY 0x10
29 #define TILEMAP_BACK 0x20
30 #define TILEMAP_FRONT 0x40
31 #define TILEMAP_ALPHA 0x80
32
33 /*
34 when rendering a split layer, pass TILEMAP_FRONT or TILEMAP_BACK or'd with the
35 tile_priority value to specify the part to draw.
36
37 when rendering a layer in alpha mode, the priority parameter
38 becomes the alpha parameter (0..255). Split mode is still
39 available in alpha mode, ignore_transparency isn't.
40 */
41
42 extern struct tile_info
43 {
44 /*
45 you must set tile_info.pen_data, tile_info.pal_data and tile_info.pen_usage
46 in the callback. You can use the SET_TILE_INFO() macro below to do this.
47 tile_info.flags and tile_info.priority will be automatically preset to 0,
48 games that don't need them don't need to explicitly set them to 0
49 */
50 const UINT8 *pen_data;
51 const pen_t *pal_data;
52 UINT32 flags;
53 int skip;
54 UINT32 tile_number; /* needed for tilemap_mark_gfxdata_dirty */
55 UINT32 pen_usage; /* TBR */
56 UINT32 priority; /* tile priority */
57 UINT8 *mask_data; /* for TILEMAP_BITMASK */
58 } tile_info;
59
60 #define SET_TILE_INFO(GFX,CODE,COLOR,FLAGS) { \
61 const struct GfxElement *gfx = Machine->gfx[(GFX)]; \
62 int _code = (CODE) % gfx->total_elements; \
63 tile_info.tile_number = _code; \
64 tile_info.pen_data = gfx->gfxdata + _code*gfx->char_modulo; \
65 tile_info.pal_data = &gfx->colortable[gfx->color_granularity * (COLOR)]; \
66 tile_info.pen_usage = gfx->pen_usage?gfx->pen_usage[_code]:0; \
67 tile_info.flags = FLAGS; \
68 if (gfx->flags & GFX_PACKED) tile_info.flags |= TILE_4BPP; \
69 if (gfx->flags & GFX_SWAPXY) tile_info.flags |= TILE_SWAPXY; \
70 }
71
72 /* tile flags, set by get_tile_info callback */
73 /* TILE_IGNORE_TRANSPARENCY is used if you need an opaque tile in a transparent layer. */
74 #define TILE_FLIPX 0x01
75 #define TILE_FLIPY 0x02
76 #define TILE_SWAPXY 0x04
77 #define TILE_IGNORE_TRANSPARENCY 0x08
78 #define TILE_4BPP 0x10
79 /* TILE_SPLIT 0x60 */
80
81 /* TILE_SPLIT is for use with TILEMAP_SPLIT layers. It selects transparency type. */
82 #define TILE_SPLIT_OFFSET 5
83 #define TILE_SPLIT(T) ((T)<<TILE_SPLIT_OFFSET)
84
85 #define TILE_FLIPYX(YX) (YX)
86 #define TILE_FLIPXY(XY) ((((XY)>>1)|((XY)<<1))&3)
87 /*
88 TILE_FLIPYX is a shortcut that can be used by approx 80% of games,
89 since yflip frequently occurs one bit higher than xflip within a
90 tile attributes byte.
91 */
92
93 #define TILE_LINE_DISABLED 0x80000000
94
95 extern struct mame_bitmap *priority_bitmap;
96
97 /* don't call these from drivers - they are called from mame.c */
98 int tilemap_init( void );
99 void tilemap_close( void );
100 void tilemap_dispose( struct tilemap *tilemap );
101
102 struct tilemap *tilemap_create(
103 void (*tile_get_info)( int memory_offset ),
104 UINT32 (*get_memory_offset)( UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows ),
105 int type,
106 int tile_width, int tile_height,
107 int num_cols, int num_rows );
108
109 void tilemap_set_transparent_pen( struct tilemap *tilemap, int pen );
110 void tilemap_set_transmask( struct tilemap *tilemap, int which, UINT32 fgmask, UINT32 bgmask );
111 void tilemap_set_depth( struct tilemap *tilemap, int tile_depth, int tile_granularity );
112
113 void tilemap_mark_tile_dirty( struct tilemap *tilemap, int memory_offset );
114 void tilemap_mark_all_tiles_dirty( struct tilemap *tilemap );
115 void tilemap_mark_gfxdata_dirty( struct tilemap *tilemap, UINT8 *dirty_array ); /* TBA */
116
117 void tilemap_set_scroll_rows( struct tilemap *tilemap, int scroll_rows ); /* default: 1 */
118 void tilemap_set_scrolldx( struct tilemap *tilemap, int dx, int dx_if_flipped );
119 void tilemap_set_scrollx( struct tilemap *tilemap, int row, int value );
120
121 void tilemap_set_scroll_cols( struct tilemap *tilemap, int scroll_cols ); /* default: 1 */
122 void tilemap_set_scrolldy( struct tilemap *tilemap, int dy, int dy_if_flipped );
123 void tilemap_set_scrolly( struct tilemap *tilemap, int col, int value );
124
125 void tilemap_set_palette_offset( struct tilemap *tilemap, int offset );
126
127 #define TILEMAP_FLIPX 0x1
128 #define TILEMAP_FLIPY 0x2
129 void tilemap_set_flip( struct tilemap *tilemap, int attributes );
130 void tilemap_set_enable( struct tilemap *tilemap, int enable );
131
132 void tilemap_draw( struct mame_bitmap *dest, const struct rectangle *cliprect, struct tilemap *tilemap, UINT32 flags, UINT32 priority );
133
134 void tilemap_draw_roz(struct mame_bitmap *dest,const struct rectangle *cliprect,struct tilemap *tilemap,
135 UINT32 startx,UINT32 starty,int incxx,int incxy,int incyx,int incyy,
136 int wraparound,
137 UINT32 flags, UINT32 priority );
138
139 /* ----xxxx tile priority
140 * ---x---- opaque in foreground
141 * --x----- opaque in background
142 * -x------ reserved
143 * x------- tile-is-dirty
144 */
145 #define TILE_FLAG_TILE_PRIORITY (0x0f)
146 #define TILE_FLAG_FG_OPAQUE (0x10)
147 #define TILE_FLAG_BG_OPAQUE (0x20)
148
149 struct mame_bitmap *tilemap_get_pixmap( struct tilemap * tilemap );
150 struct mame_bitmap *tilemap_get_transparency_bitmap( struct tilemap * tilemap );
151
152 /*********************************************************************/
153
154 UINT32 tilemap_scan_cols( UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows );
155 UINT32 tilemap_scan_rows( UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows );
156
157 /* For showcharset()'s sake */
158 UINT32 tilemap_count( void );
159 void tilemap_nb_size( UINT32 number, UINT32 *width, UINT32 *height );
160 void tilemap_nb_draw( struct mame_bitmap *dest, UINT32 number, UINT32 scrollx, UINT32 scrolly );
161
162 #ifdef MAME32JP
163 void set_tilefunc( void );
164 #endif
165
166 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26