trunk/src/mame/video/m107.cpp
r252989 | r252990 | |
160 | 160 | void m107_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
161 | 161 | { |
162 | 162 | UINT16 *spriteram = m_buffered_spriteram.get(); |
163 | | |
164 | | for (int offs = 0; offs < 0x800; offs += 4) |
| 163 | int offs; |
| 164 | UINT8 *rom = m_user1_ptr; |
| 165 | |
| 166 | for (offs = 0;offs < 0x800;offs += 4) |
165 | 167 | { |
166 | | int pri_mask = (!(spriteram[offs + 2] & 0x80)) ? 2 : 0; |
| 168 | int x,y,sprite,colour,fx,fy,y_multi,i,s_ptr,pri_mask; |
167 | 169 | |
168 | | int y = spriteram[offs + 0] & 0x1ff; |
169 | | int x = spriteram[offs + 3] & 0x1ff; |
| 170 | pri_mask = (!(spriteram[offs+2]&0x80)) ? 2 : 0; |
170 | 171 | |
| 172 | y=spriteram[offs+0]; |
| 173 | x=spriteram[offs+3]; |
| 174 | x&=0x1ff; |
| 175 | y&=0x1ff; |
| 176 | |
171 | 177 | if (x==0 || y==0) continue; /* offscreen */ |
172 | 178 | |
173 | | int sprite_code = spriteram[offs + 1] & 0x7fff; |
| 179 | sprite=spriteram[offs+1]&0x7fff; |
174 | 180 | |
175 | 181 | x = x - 16; |
176 | 182 | y = 384 - 16 - y; |
177 | 183 | |
178 | | int colour = spriteram[offs + 2] & 0x7f; |
179 | | bool fx = (spriteram[offs + 2] >> 8) & 0x1; |
180 | | bool fy = (spriteram[offs + 2] >> 8) & 0x2; |
181 | | int y_multi=(spriteram[offs + 0] >> 11) & 0x3; |
| 184 | colour=spriteram[offs+2]&0x7f; |
| 185 | fx=(spriteram[offs+2]>>8)&0x1; |
| 186 | fy=(spriteram[offs+2]>>8)&0x2; |
| 187 | y_multi=(spriteram[offs+0]>>11)&0x3; |
182 | 188 | |
183 | 189 | if (m_spritesystem == 0) |
184 | 190 | { |
185 | | y_multi = 1 << y_multi; /* 1, 2, 4 or 8 */ |
| 191 | y_multi=1 << y_multi; /* 1, 2, 4 or 8 */ |
186 | 192 | |
187 | | int s_ptr = fy ? 0 : y_multi - 1; |
| 193 | s_ptr = 0; |
| 194 | if (!fy) s_ptr+=y_multi-1; |
188 | 195 | |
189 | | for (int i = 0; i < y_multi; i++) |
| 196 | for (i=0; i<y_multi; i++) |
190 | 197 | { |
191 | | m_gfxdecode->gfx(1)->prio_transpen(bitmap, cliprect, sprite_code + s_ptr, colour, fx, fy, x, y - i * 16, screen.priority(), pri_mask, 0); |
192 | | m_gfxdecode->gfx(1)->prio_transpen(bitmap, cliprect, sprite_code + s_ptr, colour, fx, fy, x, (y - i * 16) - 0x200, screen.priority(), pri_mask, 0); /* wrap-around y */ |
| 198 | m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect, |
| 199 | sprite + s_ptr, |
| 200 | colour, |
| 201 | fx,fy, |
| 202 | x,y-i*16, |
| 203 | screen.priority(),pri_mask,0); |
193 | 204 | |
194 | | if (fy) |
195 | | s_ptr++; |
196 | | else |
197 | | s_ptr--; |
| 205 | /* wrap-around y */ |
| 206 | m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect, |
| 207 | sprite + s_ptr, |
| 208 | colour, |
| 209 | fx,fy, |
| 210 | x,(y-i*16) - 0x200, |
| 211 | screen.priority(),pri_mask,0); |
| 212 | |
| 213 | if (fy) s_ptr++; else s_ptr--; |
198 | 214 | } |
199 | 215 | } |
200 | 216 | else |
201 | 217 | { |
202 | | int rom_offs = sprite_code * 8; |
| 218 | int rom_offs = sprite*8; |
203 | 219 | |
204 | | if (m_user1_ptr[rom_offs + 1] || m_user1_ptr[rom_offs + 3] || m_user1_ptr[rom_offs + 5] || m_user1_ptr[rom_offs + 7]) |
| 220 | if (!rom) |
| 221 | return; |
| 222 | |
| 223 | if (rom[rom_offs+1] || rom[rom_offs+3] || rom[rom_offs+5] || rom[rom_offs+7]) |
205 | 224 | { |
206 | 225 | while (rom_offs < 0x40000) /* safety check */ |
207 | 226 | { |
208 | | UINT8 *sprite = m_user1_ptr + rom_offs; |
209 | 227 | /* |
210 | 228 | [1] |
211 | 229 | x--- ---- end of block marker |
r252989 | r252990 | |
226 | 244 | ---- ---x X offs hi byte |
227 | 245 | */ |
228 | 246 | |
229 | | int xdisp = (sprite[7] << 8) | sprite[6]; |
230 | | int ydisp = (sprite[3] << 8) | sprite[2]; |
231 | | int ffx = fx ^ (sprite[1] & 1); |
232 | | int ffy = fy ^ (sprite[1] & 2); |
233 | | sprite_code = (sprite[5] << 8) | sprite[4]; |
234 | | y_multi = 1 << ((sprite[3] >> 1) & 0x3); |
235 | | if (fx) |
236 | | xdisp = -xdisp - 16; |
237 | | if (fy) |
238 | | ydisp = -ydisp - (16 * y_multi - 1); |
239 | | if (!ffy) |
240 | | sprite += y_multi - 1; |
241 | | |
242 | | for (int i = 0; i < y_multi; i++) |
| 247 | int xdisp = rom[rom_offs+6]+256*rom[rom_offs+7]; |
| 248 | int ydisp = rom[rom_offs+2]+256*rom[rom_offs+3]; |
| 249 | int ffx=fx^(rom[rom_offs+1]&1); |
| 250 | int ffy=fy^(rom[rom_offs+1]&2); |
| 251 | sprite=rom[rom_offs+4]+256*rom[rom_offs+5]; |
| 252 | y_multi=1<<((rom[rom_offs+3]>>1)&0x3); |
| 253 | if (fx) xdisp = -xdisp-16; |
| 254 | if (fy) ydisp = -ydisp - (16*y_multi-1); |
| 255 | if (!ffy) sprite+=y_multi-1; |
| 256 | for (i=0; i<y_multi; i++) |
243 | 257 | { |
244 | | m_gfxdecode->gfx(1)->prio_transpen(bitmap, cliprect, sprite_code + (ffy ? i : -i), colour, ffx, ffy, (x + xdisp) & 0x1ff, (y - ydisp - 16 * i) & 0x1ff, screen.priority(), pri_mask, 0); |
| 258 | m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect, |
| 259 | sprite+(ffy?i:-i), |
| 260 | colour, |
| 261 | ffx,ffy, |
| 262 | (x+xdisp)&0x1ff,(y-ydisp-16*i)&0x1ff, |
| 263 | screen.priority(),pri_mask,0); |
245 | 264 | |
246 | 265 | /* wrap-around y */ |
247 | | m_gfxdecode->gfx(1)->prio_transpen(bitmap, cliprect, sprite_code + (ffy ? i : -i), colour, ffx, ffy, (x + xdisp) & 0x1ff, ((y - ydisp - 16 * i) & 0x1ff) - 0x200, screen.priority(), pri_mask, 0); |
| 266 | m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect, |
| 267 | sprite+(ffy?i:-i), |
| 268 | colour, |
| 269 | ffx,ffy, |
| 270 | (x+xdisp)&0x1ff,((y-ydisp-16*i)&0x1ff)-0x200, |
| 271 | screen.priority(),pri_mask,0); |
248 | 272 | } |
249 | 273 | |
250 | | if (sprite[1] & 0x80) |
251 | | break; /* end of block */ |
| 274 | if (rom[rom_offs+1]&0x80) break; /* end of block */ |
252 | 275 | |
253 | 276 | rom_offs += 8; |
254 | 277 | } |