trunk/src/mame/video/aerofgt.c
| r18901 | r18902 | |
| 304 | 304 | machine().priority_bitmap.fill(0, cliprect); |
| 305 | 305 | |
| 306 | 306 | m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); |
| 307 | | m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, -1); |
| 308 | | m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 307 | m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 308 | m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spritepalettebank, machine(), bitmap, cliprect, 1); |
| 309 | 309 | return 0; |
| 310 | 310 | } |
| 311 | 311 | |
| r18901 | r18902 | |
| 323 | 323 | m_bg2_tilemap->draw(bitmap, cliprect, 0, 0); |
| 324 | 324 | |
| 325 | 325 | /* we use the priority buffer so sprites are drawn front to back */ |
| 326 | | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_sprite_gfx+1,m_spritepalettebank, machine(), bitmap, cliprect, -1); |
| 327 | | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_sprite_gfx+1,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 326 | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 327 | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 1); |
| 328 | 328 | |
| 329 | | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_sprite_gfx+0,m_spritepalettebank, machine(), bitmap, cliprect, -1); |
| 330 | | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_sprite_gfx+0,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 329 | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 330 | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 1); |
| 331 | 331 | return 0; |
| 332 | 332 | } |
| 333 | 333 | |
| r18901 | r18902 | |
| 349 | 349 | m_bg2_tilemap->draw(bitmap, cliprect, 0, 1); |
| 350 | 350 | |
| 351 | 351 | /* we use the priority buffer so sprites are drawn front to back */ |
| 352 | | m_spr_old->spinlbrk_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_sprite_gfx+0,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 353 | | m_spr_old->spinlbrk_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_sprite_gfx+0,m_spritepalettebank, machine(), bitmap, cliprect, -1); |
| 352 | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 1); |
| 353 | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 354 | 354 | |
| 355 | | m_spr_old2->spinlbrk_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_sprite_gfx+1,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 356 | | m_spr_old2->spinlbrk_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_sprite_gfx+1,m_spritepalettebank, machine(), bitmap, cliprect, -1); |
| 355 | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 1); |
| 356 | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 357 | 357 | return 0; |
| 358 | 358 | } |
| 359 | 359 | |
| r18901 | r18902 | |
| 376 | 376 | m_bg2_tilemap->draw(bitmap, cliprect, 0, 1); |
| 377 | 377 | |
| 378 | 378 | /* we use the priority buffer so sprites are drawn front to back */ |
| 379 | | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_sprite_gfx+1,m_spritepalettebank, machine(), bitmap, cliprect, -1); //enemy |
| 380 | | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_sprite_gfx+1,m_spritepalettebank, machine(), bitmap, cliprect, 0); //enemy |
| 379 | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 0); //enemy |
| 380 | m_spr_old2->turbofrc_draw_sprites(m_spriteram3+0x200,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 1); //enemy |
| 381 | 381 | |
| 382 | | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_sprite_gfx+0,m_spritepalettebank, machine(), bitmap, cliprect, -1); //ship |
| 383 | | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_sprite_gfx+0,m_spritepalettebank, machine(), bitmap, cliprect, 0); //intro |
| 382 | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 0); //ship |
| 383 | m_spr_old->turbofrc_draw_sprites(m_spriteram3+0x000,m_spriteram3.bytes()/2,m_spritepalettebank, machine(), bitmap, cliprect, 1); //intro |
| 384 | 384 | return 0; |
| 385 | 385 | } |
| 386 | 386 | |
| r18901 | r18902 | |
| 847 | 847 | m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); |
| 848 | 848 | } |
| 849 | 849 | |
| 850 | | m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, -1); |
| 851 | | m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_sprite_gfx,m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 850 | m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spritepalettebank, machine(), bitmap, cliprect, 0); |
| 851 | m_spr_old->turbofrc_draw_sprites(m_spriteram3,m_spriteram3.bytes(),m_spritepalettebank, machine(), bitmap, cliprect, 1); |
| 852 | 852 | return 0; |
| 853 | 853 | } |
trunk/src/mame/video/vsystem_spr2.c
| r18901 | r18902 | |
| 15 | 15 | // Formula 1 Grand Prix (1) |
| 16 | 16 | // Pipe Dream |
| 17 | 17 | |
| 18 | // there were lots of comments saying drivers using the |
| 19 | // static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; |
| 20 | // table for zooming needed upgrading, are we sure this isn't one of the |
| 21 | // differences between this sprite chip and the one in vsystem_spr.c, pspikes zooming is very rough |
| 18 | 22 | |
| 23 | |
| 19 | 24 | #include "emu.h" |
| 20 | 25 | #include "vsystem_spr2.h" |
| 21 | 26 | |
| r18901 | r18902 | |
| 26 | 31 | : device_t(mconfig, VSYSTEM_SPR2, "vsystem_spr2_device", tag, owner, clock) |
| 27 | 32 | { |
| 28 | 33 | m_newtilecb = vsystem_tile2_indirection_delegate(FUNC(vsystem_spr2_device::tile_callback_noindirect), this); |
| 34 | m_pritype = 0; // hack until we have better handling |
| 35 | m_gfx_region = 0; |
| 36 | m_xoffs = 0; |
| 37 | m_yoffs = 0; |
| 29 | 38 | } |
| 30 | 39 | |
| 31 | 40 | void vsystem_spr2_device::set_tile_indirect_cb(device_t &device,vsystem_tile2_indirection_delegate newtilecb) |
| r18901 | r18902 | |
| 34 | 43 | dev.m_newtilecb = newtilecb; |
| 35 | 44 | } |
| 36 | 45 | |
| 46 | void vsystem_spr2_device::set_pritype(device_t &device,int pritype) |
| 47 | { |
| 48 | vsystem_spr2_device &dev = downcast<vsystem_spr2_device &>(device); |
| 49 | dev.m_pritype = pritype; |
| 50 | } |
| 51 | |
| 52 | void vsystem_spr2_device::set_gfx_region(device_t &device, int gfx_region) |
| 53 | { |
| 54 | vsystem_spr2_device &dev = downcast<vsystem_spr2_device &>(device); |
| 55 | dev.m_gfx_region = gfx_region; |
| 56 | } |
| 57 | |
| 58 | void vsystem_spr2_device::set_offsets(device_t &device, int xoffs, int yoffs) |
| 59 | { |
| 60 | vsystem_spr2_device &dev = downcast<vsystem_spr2_device &>(device); |
| 61 | dev.m_xoffs = xoffs; |
| 62 | dev.m_yoffs = yoffs; |
| 63 | } |
| 64 | |
| 37 | 65 | UINT32 vsystem_spr2_device::tile_callback_noindirect(UINT32 tile) |
| 38 | 66 | { |
| 39 | 67 | return tile; |
| r18901 | r18902 | |
| 87 | 115 | } |
| 88 | 116 | |
| 89 | 117 | template<class _BitmapClass> |
| 90 | | void vsystem_spr2_device::turbofrc_draw_sprites_common( UINT16* spriteram3, int spriteram3_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, int chip_disabled_pri ) |
| 118 | void vsystem_spr2_device::turbofrc_draw_sprites_common( UINT16* spriteram3, int spriteram3_bytes, int spritepalettebank, running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, int pri_param ) |
| 91 | 119 | { |
| 92 | | int attr_start, base, first; |
| 93 | | base = 0;//chip * 0x0200; |
| 94 | | first = 4 * spriteram3[0x1fe + base]; |
| 120 | int attr_start, first; |
| 121 | first = 4 * spriteram3[0x1fe]; |
| 95 | 122 | |
| 96 | | for (attr_start = base + 0x0200 - 8; attr_start >= first + base; attr_start -= 4) |
| 123 | first &= 0x1ff; |
| 124 | if (first>0x200-4) |
| 125 | first = 0x200-4; |
| 126 | |
| 127 | int start,end,inc; |
| 128 | |
| 129 | if (m_pritype == 0 || m_pritype == 1 || m_pritype == 2) // prdrawgfx cases |
| 97 | 130 | { |
| 131 | start = 0x200 - 8; |
| 132 | end = first-4; |
| 133 | inc = -4; |
| 134 | } |
| 135 | else // drawgfx cases |
| 136 | { |
| 137 | start = first; |
| 138 | end = 0x200 -4; |
| 139 | inc = 4; |
| 140 | } |
| 141 | |
| 142 | for (attr_start = start; attr_start != end; attr_start += inc) |
| 143 | { |
| 98 | 144 | int x, y; |
| 99 | | // some other drivers still use this wrong table, they have to be upgraded |
| 100 | | // int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; |
| 101 | 145 | |
| 102 | | |
| 103 | 146 | if (!get_sprite_attributes(&spriteram3[attr_start])) |
| 104 | 147 | continue; |
| 105 | 148 | |
| 149 | // pipedrm |
| 150 | curr_sprite.ox += m_xoffs; |
| 151 | curr_sprite.oy += m_yoffs; |
| 106 | 152 | |
| 107 | | if ( chip_disabled_pri & !curr_sprite.pri) |
| 108 | | continue; |
| 153 | int usepri = 0; |
| 109 | 154 | |
| 110 | | if ((!chip_disabled_pri) & (curr_sprite.pri >> 4)) |
| 111 | | continue; |
| 112 | | |
| 113 | | |
| 114 | | |
| 115 | | curr_sprite.color += 16 * spritepalettebank; |
| 116 | | |
| 117 | | // aerofgt has this adjustment, but doing it here would break turbo force title screen |
| 118 | | // curr_sprite.ox += (curr_sprite.xsize*curr_sprite.zoomx+2)/4; |
| 119 | | // curr_sprite.oy += (curr_sprite.ysize*curr_sprite.zoomy+2)/4; |
| 120 | | |
| 121 | | curr_sprite.zoomx = 32 - curr_sprite.zoomx; |
| 122 | | curr_sprite.zoomy = 32 - curr_sprite.zoomy; |
| 123 | | |
| 124 | | for (y = 0; y <= curr_sprite.ysize; y++) |
| 155 | // these are still calling the function multiple times to filter out priorities, even if some are also using pdrawgfx(!) |
| 156 | if (m_pritype == 0 || m_pritype == 1 || m_pritype == 3) // turbo force, spinlbrk, pipedrm etc. |
| 125 | 157 | { |
| 126 | | int sx, sy; |
| 158 | if ((curr_sprite.pri>>4) != pri_param) |
| 159 | continue; |
| 160 | } |
| 127 | 161 | |
| 128 | | if (curr_sprite.flipy) |
| 129 | | sy = ((curr_sprite.oy + curr_sprite.zoomy * (curr_sprite.ysize - y)/2 + 16) & 0x1ff) - 16; |
| 130 | | else |
| 131 | | sy = ((curr_sprite.oy + curr_sprite.zoomy * y / 2 + 16) & 0x1ff) - 16; |
| 132 | | |
| 133 | | for (x = 0; x <= curr_sprite.xsize; x++) |
| 134 | | { |
| 135 | | int curr; |
| 136 | | |
| 137 | | if (curr_sprite.flipx) |
| 138 | | sx = ((curr_sprite.ox + curr_sprite.zoomx * (curr_sprite.xsize - x) / 2 + 16) & 0x1ff) - 16; |
| 139 | | else |
| 140 | | sx = ((curr_sprite.ox + curr_sprite.zoomx * x / 2 + 16) & 0x1ff) - 16; |
| 141 | | |
| 142 | | curr = m_newtilecb(curr_sprite.map++); |
| 143 | | |
| 144 | | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_gfx], |
| 145 | | curr, |
| 146 | | curr_sprite.color, |
| 147 | | curr_sprite.flipx,curr_sprite.flipy, |
| 148 | | sx,sy, |
| 149 | | curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, |
| 150 | | machine.priority_bitmap,curr_sprite.pri ? 0 : 2,15); |
| 151 | | } |
| 152 | | handle_xsize_map_inc(); |
| 162 | |
| 163 | if (m_pritype == 0) // turbo force etc. |
| 164 | { |
| 165 | usepri = curr_sprite.pri ? 0 : 2; |
| 153 | 166 | } |
| 154 | | } |
| 155 | | } |
| 167 | else if (m_pritype == 1) // spinlbrk |
| 168 | { |
| 169 | usepri = curr_sprite.pri ? 2 : 0; |
| 170 | } |
| 171 | else if (m_pritype == 2) // f1gp |
| 172 | { |
| 173 | usepri = pri_param; |
| 174 | } |
| 156 | 175 | |
| 157 | | void vsystem_spr2_device::turbofrc_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip_disabled_pri ) |
| 158 | | { turbofrc_draw_sprites_common( spriteram3, spriteram3_bytes, sprite_gfx, spritepalettebank, machine, bitmap, cliprect, chip_disabled_pri ); } |
| 159 | 176 | |
| 160 | | void vsystem_spr2_device::turbofrc_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip_disabled_pri ) |
| 161 | | { turbofrc_draw_sprites_common( spriteram3, spriteram3_bytes, sprite_gfx, spritepalettebank, machine, bitmap, cliprect, chip_disabled_pri ); } |
| 162 | 177 | |
| 163 | | |
| 164 | | template<class _BitmapClass> |
| 165 | | void vsystem_spr2_device::spinlbrk_draw_sprites_common( UINT16* spriteram3, int spriteram3_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, int chip_disabled_pri ) |
| 166 | | { |
| 167 | | int attr_start, base, first; |
| 168 | | base = 0;//chip * 0x0200; |
| 169 | | first = 4 * spriteram3[0x1fe + base]; |
| 170 | | |
| 171 | | for (attr_start = base + 0x0200-8; attr_start >= first + base; attr_start -= 4) |
| 172 | | { |
| 173 | | int x, y; |
| 174 | | // some other drivers still use this wrong table, they have to be upgraded |
| 175 | | // int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; |
| 176 | | |
| 177 | | |
| 178 | | if (!get_sprite_attributes(&spriteram3[attr_start])) |
| 179 | | continue; |
| 180 | | |
| 181 | | |
| 182 | | if ( chip_disabled_pri & !curr_sprite.pri) |
| 183 | | continue; |
| 184 | | if ((!chip_disabled_pri) & (curr_sprite.pri >> 4)) |
| 185 | | continue; |
| 186 | | |
| 187 | | |
| 188 | 178 | curr_sprite.color += 16 * spritepalettebank; |
| 189 | 179 | |
| 190 | | // aerofgt has this adjustment, but doing it here would break turbo force title screen |
| 191 | | // curr_sprite.ox += (curr_sprite.xsize*curr_sprite.zoomx+2)/4; |
| 192 | | // curr_sprite.oy += (curr_sprite.ysize*curr_sprite.zoomy+2)/4; |
| 193 | | |
| 194 | 180 | curr_sprite.zoomx = 32 - curr_sprite.zoomx; |
| 195 | 181 | curr_sprite.zoomy = 32 - curr_sprite.zoomy; |
| 196 | 182 | |
| r18901 | r18902 | |
| 214 | 200 | |
| 215 | 201 | curr = m_newtilecb(curr_sprite.map++); |
| 216 | 202 | |
| 217 | | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_gfx], |
| 218 | | curr, |
| 219 | | curr_sprite.color, |
| 220 | | curr_sprite.flipx,curr_sprite.flipy, |
| 221 | | sx,sy, |
| 222 | | curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, |
| 223 | | machine.priority_bitmap,curr_sprite.pri ? 2 : 0,15); |
| 224 | | } |
| 225 | | handle_xsize_map_inc(); |
| 226 | | } |
| 227 | | } |
| 228 | | } |
| 229 | 203 | |
| 230 | | void vsystem_spr2_device::spinlbrk_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip_disabled_pri ) |
| 231 | | { spinlbrk_draw_sprites_common( spriteram3, spriteram3_bytes, sprite_gfx, spritepalettebank, machine, bitmap, cliprect, chip_disabled_pri ); } |
| 232 | | |
| 233 | | void vsystem_spr2_device::spinlbrk_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, int sprite_gfx, int spritepalettebank, running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip_disabled_pri ) |
| 234 | | { spinlbrk_draw_sprites_common( spriteram3, spriteram3_bytes, sprite_gfx, spritepalettebank, machine, bitmap, cliprect, chip_disabled_pri ); } |
| 235 | | |
| 236 | | |
| 237 | | |
| 238 | | |
| 239 | | void vsystem_spr2_device::welltris_draw_sprites( UINT16* spriteram, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 240 | | { |
| 241 | | static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; |
| 242 | | int offs; |
| 243 | | const rectangle &visarea = machine.primary_screen->visible_area(); |
| 244 | | |
| 245 | | /* draw the sprites */ |
| 246 | | for (offs = 0; offs < 0x200 - 4; offs += 4) |
| 247 | | { |
| 248 | | if (!get_sprite_attributes(&spriteram[offs])) |
| 249 | | continue; |
| 250 | | |
| 251 | | curr_sprite.map&=0x1fff; |
| 252 | | curr_sprite.color += (0x10 * spritepalettebank); |
| 253 | | |
| 254 | | int xt, yt; |
| 255 | | |
| 256 | | |
| 257 | | /* compute the zoom factor -- stolen from aerofgt.c */ |
| 258 | | curr_sprite.zoomx = 16 - zoomtable[curr_sprite.zoomx] / 8; |
| 259 | | curr_sprite.zoomy = 16 - zoomtable[curr_sprite.zoomy] / 8; |
| 260 | | |
| 261 | | /* wrap around */ |
| 262 | | if (curr_sprite.ox > visarea.max_x) curr_sprite.ox -= 0x200; |
| 263 | | if (curr_sprite.oy > visarea.max_y) curr_sprite.oy -= 0x200; |
| 264 | | |
| 265 | | /* normal case */ |
| 266 | | if (!curr_sprite.flipx && !curr_sprite.flipy) { |
| 267 | | for (yt = 0; yt <= curr_sprite.ysize; yt++) { |
| 268 | | for (xt = 0; xt <= curr_sprite.xsize; xt++) |
| 204 | if (m_pritype == 0 || m_pritype == 1 || m_pritype == 2) // pdrawgfx cases |
| 269 | 205 | { |
| 270 | | int curr = m_newtilecb(curr_sprite.map++); |
| 271 | | |
| 272 | | drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], curr, curr_sprite.color, 0, 0, |
| 273 | | curr_sprite.ox + xt * curr_sprite.zoomx, curr_sprite.oy + yt * curr_sprite.zoomy, |
| 274 | | 0x1000 * curr_sprite.zoomx, 0x1000 * curr_sprite.zoomy, 15); |
| 206 | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[m_gfx_region], curr, curr_sprite.color, curr_sprite.flipx,curr_sprite.flipy, sx-0x000,sy-0x000, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,usepri,15); |
| 207 | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[m_gfx_region], curr, curr_sprite.color, curr_sprite.flipx,curr_sprite.flipy, sx-0x200,sy-0x000, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,usepri,15); |
| 208 | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[m_gfx_region], curr, curr_sprite.color, curr_sprite.flipx,curr_sprite.flipy, sx-0x000,sy-0x200, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,usepri,15); |
| 209 | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[m_gfx_region], curr, curr_sprite.color, curr_sprite.flipx,curr_sprite.flipy, sx-0x200,sy-0x200, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11, machine.priority_bitmap,usepri,15); |
| 275 | 210 | } |
| 276 | | handle_xsize_map_inc(); |
| 277 | | } |
| 278 | | } |
| 279 | | |
| 280 | | /* curr_sprite.flipxped case */ |
| 281 | | else if (curr_sprite.flipx && !curr_sprite.flipy) { |
| 282 | | for (yt = 0; yt <= curr_sprite.ysize; yt++) { |
| 283 | | for (xt = 0; xt <= curr_sprite.xsize; xt++) |
| 211 | else // drawgfx cases (welltris, pipedrm) |
| 284 | 212 | { |
| 285 | | int curr = m_newtilecb(curr_sprite.map++); |
| 286 | | |
| 287 | | drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], curr, curr_sprite.color, 1, 0, |
| 288 | | curr_sprite.ox + (curr_sprite.xsize - xt) * curr_sprite.zoomx, curr_sprite.oy + yt * curr_sprite.zoomy, |
| 289 | | 0x1000 * curr_sprite.zoomx, 0x1000 * curr_sprite.zoomy, 15); |
| 213 | drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[m_gfx_region], curr, curr_sprite.color, curr_sprite.flipx,curr_sprite.flipy, sx-0x000,sy-0x000, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11,15); |
| 214 | drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[m_gfx_region], curr, curr_sprite.color, curr_sprite.flipx,curr_sprite.flipy, sx-0x200,sy-0x000, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11,15); |
| 215 | drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[m_gfx_region], curr, curr_sprite.color, curr_sprite.flipx,curr_sprite.flipy, sx-0x000,sy-0x200, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11,15); |
| 216 | drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[m_gfx_region], curr, curr_sprite.color, curr_sprite.flipx,curr_sprite.flipy, sx-0x200,sy-0x200, curr_sprite.zoomx << 11, curr_sprite.zoomy << 11,15); |
| 290 | 217 | } |
| 291 | | handle_xsize_map_inc(); |
| 292 | | } |
| 293 | | } |
| 294 | 218 | |
| 295 | | /* curr_sprite.flipyped case */ |
| 296 | | else if (!curr_sprite.flipx && curr_sprite.flipy) { |
| 297 | | for (yt = 0; yt <= curr_sprite.ysize; yt++) { |
| 298 | | for (xt = 0; xt <= curr_sprite.xsize; xt++) |
| 299 | | { |
| 300 | | int curr = m_newtilecb(curr_sprite.map++); |
| 301 | | |
| 302 | | drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], curr, curr_sprite.color, 0, 1, |
| 303 | | curr_sprite.ox + xt * curr_sprite.zoomx, curr_sprite.oy + (curr_sprite.ysize - yt) * curr_sprite.zoomy, |
| 304 | | 0x1000 * curr_sprite.zoomx, 0x1000 * curr_sprite.zoomy, 15); |
| 305 | | } |
| 306 | | handle_xsize_map_inc(); |
| 307 | 219 | } |
| 308 | | } |
| 309 | | |
| 310 | | /* x & curr_sprite.flipyped case */ |
| 311 | | else { |
| 312 | | for (yt = 0; yt <= curr_sprite.ysize; yt++) { |
| 313 | | for (xt = 0; xt <= curr_sprite.xsize; xt++) |
| 314 | | { |
| 315 | | int curr = m_newtilecb(curr_sprite.map++); |
| 316 | | |
| 317 | | drawgfxzoom_transpen(bitmap, cliprect, machine.gfx[1], curr, curr_sprite.color, 1, 1, |
| 318 | | curr_sprite.ox + (curr_sprite.xsize - xt) * curr_sprite.zoomx, curr_sprite.oy + (curr_sprite.ysize - yt) * curr_sprite.zoomy, |
| 319 | | 0x1000 * curr_sprite.zoomx, 0x1000 * curr_sprite.zoomy, 15); |
| 320 | | } |
| 321 | | handle_xsize_map_inc(); |
| 322 | | } |
| 323 | | } |
| 324 | | } |
| 325 | | } |
| 326 | | |
| 327 | | |
| 328 | | |
| 329 | | void vsystem_spr2_device::f1gp_draw_sprites( int gfxrgn, UINT16* sprvram, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int primask ) |
| 330 | | { |
| 331 | | int attr_start, first; |
| 332 | | UINT16 *spram = sprvram; |
| 333 | | |
| 334 | | first = 4 * spram[0x1fe]; |
| 335 | | |
| 336 | | for (attr_start = 0x0200 - 8; attr_start >= first; attr_start -= 4) |
| 337 | | { |
| 338 | | int x, y; |
| 339 | | /* table hand made by looking at the ship explosion in attract mode */ |
| 340 | | /* it's almost a logarithmic scale but not exactly */ |
| 341 | | static const int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; |
| 342 | | |
| 343 | | |
| 344 | | if (!get_sprite_attributes(&spram[attr_start])) |
| 345 | | continue; |
| 346 | | |
| 347 | | curr_sprite.zoomx = 16 - zoomtable[curr_sprite.zoomx] / 8; |
| 348 | | curr_sprite.zoomy = 16 - zoomtable[curr_sprite.zoomy] / 8; |
| 349 | | |
| 350 | | for (y = 0; y <= curr_sprite.ysize; y++) |
| 351 | | { |
| 352 | | int sx, sy; |
| 353 | | |
| 354 | | if (curr_sprite.flipy) sy = ((curr_sprite.oy + curr_sprite.zoomy * (curr_sprite.ysize - y) + 16) & 0x1ff) - 16; |
| 355 | | else sy = ((curr_sprite.oy + curr_sprite.zoomy * y + 16) & 0x1ff) - 16; |
| 356 | | |
| 357 | | for (x = 0; x <= curr_sprite.xsize; x++) |
| 358 | | { |
| 359 | | int curr; |
| 360 | | |
| 361 | | if (curr_sprite.flipx) sx = ((curr_sprite.ox + curr_sprite.zoomx * (curr_sprite.xsize - x) + 16) & 0x1ff) - 16; |
| 362 | | else sx = ((curr_sprite.ox + curr_sprite.zoomx * x + 16) & 0x1ff) - 16; |
| 363 | | |
| 364 | | curr = m_newtilecb(curr_sprite.map++); |
| 365 | | |
| 366 | | pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[gfxrgn], |
| 367 | | curr, |
| 368 | | curr_sprite.color, |
| 369 | | curr_sprite.flipx,curr_sprite.flipy, |
| 370 | | sx,sy, |
| 371 | | 0x1000 * curr_sprite.zoomx,0x1000 * curr_sprite.zoomy, |
| 372 | | machine.priority_bitmap, |
| 373 | | // pri ? 0 : 0x2); |
| 374 | | primask,15); |
| 375 | | } |
| 376 | 220 | handle_xsize_map_inc(); |
| 377 | 221 | } |
| 378 | 222 | } |
| 379 | 223 | } |
| 380 | 224 | |
| 381 | | // the same but for an 8-bit system.. |
| 382 | | void vsystem_spr2_device::draw_sprites_pipedrm( UINT8* spriteram, int spriteram_bytes, int flipscreen, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int draw_priority ) |
| 383 | | { |
| 384 | | static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 }; |
| 385 | | const rectangle &visarea = screen.visible_area(); |
| 386 | | // UINT8 *spriteram = spriteram; |
| 387 | | int offs; |
| 225 | void vsystem_spr2_device::turbofrc_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, int spritepalettebank, running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_param ) |
| 226 | { turbofrc_draw_sprites_common( spriteram3, spriteram3_bytes, spritepalettebank, machine, bitmap, cliprect, pri_param ); } |
| 388 | 227 | |
| 389 | | /* draw the sprites */ |
| 390 | | for (offs = 0; offs < spriteram_bytes; offs += 8) |
| 391 | | { |
| 392 | | int data2 = spriteram[offs + 4] | (spriteram[offs + 5] << 8); |
| 393 | | int priority = (data2 >> 4) & 1; |
| 228 | void vsystem_spr2_device::turbofrc_draw_sprites( UINT16* spriteram3, int spriteram3_bytes, int spritepalettebank, running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri_param ) |
| 229 | { turbofrc_draw_sprites_common( spriteram3, spriteram3_bytes, spritepalettebank, machine, bitmap, cliprect, pri_param ); } |
| 394 | 230 | |
| 395 | | /* turns out the sprites are the same as in aerofgt.c */ |
| 396 | | if (priority == draw_priority) |
| 397 | | { |
| 398 | | if (!get_sprite_attributes((UINT16*)&spriteram[offs])) |
| 399 | | continue; |
| 400 | 231 | |
| 401 | | curr_sprite.oy -= 6; |
| 402 | | curr_sprite.ox -= 13; |
| 403 | 232 | |
| 404 | | |
| 405 | | |
| 406 | | int xt, yt; |
| 407 | | |
| 408 | | |
| 409 | | |
| 410 | | /* compute the zoom factor -- stolen from aerofgt.c */ |
| 411 | | curr_sprite.zoomx = 16 - zoomtable[curr_sprite.zoomx] / 8; |
| 412 | | curr_sprite.zoomy = 16 - zoomtable[curr_sprite.zoomy] / 8; |
| 413 | | |
| 414 | | /* wrap around */ |
| 415 | | if (curr_sprite.ox > visarea.max_x) |
| 416 | | curr_sprite.ox -= 0x200; |
| 417 | | if (curr_sprite.oy > visarea.max_y) |
| 418 | | curr_sprite.oy -= 0x200; |
| 419 | | |
| 420 | | /* flip ? */ |
| 421 | | if (flipscreen) |
| 422 | | { |
| 423 | | curr_sprite.oy = visarea.max_y - curr_sprite.oy - 16 * curr_sprite.ysize - 4; |
| 424 | | curr_sprite.ox = visarea.max_x - curr_sprite.ox - 16 * curr_sprite.xsize - 24; |
| 425 | | curr_sprite.flipx=!curr_sprite.flipx; |
| 426 | | curr_sprite.flipy=!curr_sprite.flipy; |
| 427 | | } |
| 428 | | |
| 429 | | /* normal case */ |
| 430 | | if (!curr_sprite.flipx && !curr_sprite.flipy) |
| 431 | | { |
| 432 | | for (yt = 0; yt <= curr_sprite.ysize; yt++) |
| 433 | | { |
| 434 | | for (xt = 0; xt <= curr_sprite.xsize; xt++) |
| 435 | | { |
| 436 | | int curr = m_newtilecb(curr_sprite.map++); |
| 437 | | |
| 438 | | drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], curr, curr_sprite.color, 0, 0, |
| 439 | | curr_sprite.ox + xt * curr_sprite.zoomx, curr_sprite.oy + yt * curr_sprite.zoomy, |
| 440 | | 0x1000 * curr_sprite.zoomx, 0x1000 * curr_sprite.zoomy, 15); |
| 441 | | } |
| 442 | | handle_xsize_map_inc(); |
| 443 | | } |
| 444 | | } |
| 445 | | |
| 446 | | /* curr_sprite.flipxped case */ |
| 447 | | else if (curr_sprite.flipx && !curr_sprite.flipy) |
| 448 | | { |
| 449 | | for (yt = 0; yt <= curr_sprite.ysize; yt++) |
| 450 | | { |
| 451 | | for (xt = 0; xt <= curr_sprite.xsize; xt++) |
| 452 | | { |
| 453 | | int curr = m_newtilecb(curr_sprite.map++); |
| 454 | | |
| 455 | | drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], curr, curr_sprite.color, 1, 0, |
| 456 | | curr_sprite.ox + (curr_sprite.xsize - xt) * curr_sprite.zoomx, curr_sprite.oy + yt * curr_sprite.zoomy, |
| 457 | | 0x1000 * curr_sprite.zoomx, 0x1000 * curr_sprite.zoomy, 15); |
| 458 | | } |
| 459 | | handle_xsize_map_inc(); |
| 460 | | } |
| 461 | | } |
| 462 | | |
| 463 | | /* curr_sprite.flipyped case */ |
| 464 | | else if (!curr_sprite.flipx && curr_sprite.flipy) |
| 465 | | { |
| 466 | | for (yt = 0; yt <= curr_sprite.ysize; yt++) |
| 467 | | { |
| 468 | | for (xt = 0; xt <= curr_sprite.xsize; xt++) |
| 469 | | { |
| 470 | | int curr = m_newtilecb(curr_sprite.map++); |
| 471 | | |
| 472 | | drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], curr, curr_sprite.color, 0, 1, |
| 473 | | curr_sprite.ox + xt * curr_sprite.zoomx, curr_sprite.oy + (curr_sprite.ysize - yt) * curr_sprite.zoomy, |
| 474 | | 0x1000 * curr_sprite.zoomx, 0x1000 * curr_sprite.zoomy, 15); |
| 475 | | } |
| 476 | | handle_xsize_map_inc(); |
| 477 | | } |
| 478 | | } |
| 479 | | |
| 480 | | /* x & curr_sprite.flipyped case */ |
| 481 | | else |
| 482 | | { |
| 483 | | for (yt = 0; yt <= curr_sprite.ysize; yt++) |
| 484 | | { |
| 485 | | for (xt = 0; xt <= curr_sprite.xsize; xt++) |
| 486 | | { |
| 487 | | int curr = m_newtilecb(curr_sprite.map++); |
| 488 | | |
| 489 | | drawgfxzoom_transpen(bitmap, cliprect, screen.machine().gfx[2], curr, curr_sprite.color, 1, 1, |
| 490 | | curr_sprite.ox + (curr_sprite.xsize - xt) * curr_sprite.zoomx, curr_sprite.oy + (curr_sprite.ysize - yt) * curr_sprite.zoomy, |
| 491 | | 0x1000 * curr_sprite.zoomx, 0x1000 * curr_sprite.zoomy, 15); |
| 492 | | } |
| 493 | | handle_xsize_map_inc(); |
| 494 | | } |
| 495 | | } |
| 496 | | } |
| 497 | | } |
| 498 | | } |