src/mess/drivers/scv.c
| r6873 | r6874 | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | |
| 193 | | INLINE void draw_sprite( bitmap_t *bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col ) |
| 193 | INLINE void draw_sprite( bitmap_t *bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y ) |
| 194 | 194 | { |
| 195 | 195 | int j; |
| 196 | 196 | |
| 197 | | for ( j = 0; j < 32; j += 4 ) |
| 197 | y += clip_y * 2; |
| 198 | for ( j = clip_y * 4; j < 32; j += 4 ) |
| 198 | 199 | { |
| 199 | 200 | UINT8 pat0 = scv_vram[ tile_idx * 32 + j + 0 ]; |
| 200 | 201 | UINT8 pat1 = scv_vram[ tile_idx * 32 + j + 1 ]; |
| 201 | 202 | UINT8 pat2 = scv_vram[ tile_idx * 32 + j + 2 ]; |
| 202 | 203 | UINT8 pat3 = scv_vram[ tile_idx * 32 + j + 3 ]; |
| 203 | 204 | |
| 204 | | plot_sprite_part( bitmap, x , y, pat0 >> 4, col ); |
| 205 | | plot_sprite_part( bitmap, x + 4, y, pat1 >> 4, col ); |
| 206 | | plot_sprite_part( bitmap, x + 8, y, pat2 >> 4, col ); |
| 207 | | plot_sprite_part( bitmap, x + 12, y, pat3 >> 4, col ); |
| 205 | if ( ( top && j < 16 ) || ( bottom && j >= 16 ) ) |
| 206 | { |
| 207 | if ( left ) |
| 208 | { |
| 209 | plot_sprite_part( bitmap, x , y, pat0 >> 4, col ); |
| 210 | plot_sprite_part( bitmap, x + 4, y, pat1 >> 4, col ); |
| 211 | } |
| 212 | if ( right ) |
| 213 | { |
| 214 | plot_sprite_part( bitmap, x + 8, y, pat2 >> 4, col ); |
| 215 | plot_sprite_part( bitmap, x + 12, y, pat3 >> 4, col ); |
| 216 | } |
| 208 | 217 | |
| 209 | | plot_sprite_part( bitmap, x , y + 1, pat0 & 0x0f, col ); |
| 210 | | plot_sprite_part( bitmap, x + 4, y + 1, pat1 & 0x0f, col ); |
| 211 | | plot_sprite_part( bitmap, x + 8, y + 1, pat2 & 0x0f, col ); |
| 212 | | plot_sprite_part( bitmap, x + 12, y + 1, pat3 & 0x0f, col ); |
| 218 | if ( left ) |
| 219 | { |
| 220 | plot_sprite_part( bitmap, x , y + 1, pat0 & 0x0f, col ); |
| 221 | plot_sprite_part( bitmap, x + 4, y + 1, pat1 & 0x0f, col ); |
| 222 | } |
| 223 | if ( right ) |
| 224 | { |
| 225 | plot_sprite_part( bitmap, x + 8, y + 1, pat2 & 0x0f, col ); |
| 226 | plot_sprite_part( bitmap, x + 12, y + 1, pat3 & 0x0f, col ); |
| 227 | } |
| 228 | } |
| 213 | 229 | |
| 214 | 230 | y += 2; |
| 215 | 231 | } |
| r6873 | r6874 | |
| 320 | 336 | { |
| 321 | 337 | UINT8 spr_y = scv_vram[ 0x1200 + i * 4 ] & 0xfe; |
| 322 | 338 | UINT8 y_32 = scv_vram[ 0x1200 + i * 4 ] & 0x01; /* Xx32 sprite */ |
| 339 | UINT8 clip = scv_vram[ 0x1201 + i * 4 ] >> 4; |
| 323 | 340 | UINT8 col = scv_vram[ 0x1201 + i * 4 ] & 0x0f; |
| 324 | 341 | UINT8 spr_x = scv_vram[ 0x1202 + i * 4 ] & 0xfe; |
| 325 | 342 | UINT8 x_32 = scv_vram[ 0x1202 + i * 4 ] & 0x01; /* 32xX sprite */ |
| 326 | 343 | UINT8 tile_idx = scv_vram[ 0x1203 + i * 4 ] & 0x7f; |
| 344 | UINT8 half = scv_vram[ 0x1203 + i * 4] & 0x80; |
| 345 | UINT8 left = 1; |
| 346 | UINT8 right = 1; |
| 347 | UINT8 top = 1; |
| 348 | UINT8 bottom = 1; |
| 327 | 349 | |
| 328 | 350 | if ( !col ) |
| 329 | 351 | continue; |
| 330 | 352 | |
| 353 | if ( half ) |
| 354 | { |
| 355 | if ( tile_idx & 0x40 ) |
| 356 | { |
| 357 | if ( y_32 ) |
| 358 | { |
| 359 | spr_y -= 8; |
| 360 | top = 0; |
| 361 | bottom = 1; |
| 362 | y_32 = 0; |
| 363 | } |
| 364 | else |
| 365 | { |
| 366 | top = 1; |
| 367 | bottom = 0; |
| 368 | } |
| 369 | } |
| 370 | if ( x_32 ) |
| 371 | { |
| 372 | spr_x -= 8; |
| 373 | left = 0; |
| 374 | right = 1; |
| 375 | x_32 = 0; |
| 376 | } |
| 377 | else |
| 378 | { |
| 379 | left = 1; |
| 380 | right = 0; |
| 381 | } |
| 382 | } |
| 383 | |
| 331 | 384 | /* Check if 2 color sprites are enabled */ |
| 332 | 385 | if ( ( scv_vram[0x1400] & 0x20 ) && ( i & 0x20 ) ) |
| 333 | 386 | { |
| 334 | 387 | /* 2 color sprite handling */ |
| 335 | | draw_sprite( bitmap, spr_x, spr_y, tile_idx, col ); |
| 388 | draw_sprite( bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip ); |
| 336 | 389 | if ( x_32 || y_32 ) |
| 337 | 390 | { |
| 338 | 391 | static const UINT8 spr_2col_lut0[16] = { 0, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 1, 1 }; |
| 339 | 392 | static const UINT8 spr_2col_lut1[16] = { 0, 1, 8, 11, 2, 3, 10, 9, 4, 5, 12, 13, 6, 7, 14, 15 }; |
| 340 | 393 | |
| 341 | | draw_sprite( bitmap, spr_x, spr_y, tile_idx + 8 * x_32 + y_32, ( i & 0x40 ) ? spr_2col_lut1[col] : spr_2col_lut0[col] ); |
| 394 | draw_sprite( bitmap, spr_x, spr_y, tile_idx + 8 * x_32 + y_32, ( i & 0x40 ) ? spr_2col_lut1[col] : spr_2col_lut0[col], left, right, top, bottom, clip ); |
| 342 | 395 | } |
| 343 | 396 | } |
| 344 | 397 | else |
| 345 | 398 | { |
| 346 | 399 | /* regular sprite handling */ |
| 347 | | draw_sprite( bitmap, spr_x, spr_y, tile_idx, col ); |
| 400 | draw_sprite( bitmap, spr_x, spr_y, tile_idx, col, left, right, top, bottom, clip ); |
| 348 | 401 | if ( x_32 ) |
| 349 | 402 | { |
| 350 | | draw_sprite( bitmap, spr_x + 16, spr_y, tile_idx + 8, col ); |
| 403 | draw_sprite( bitmap, spr_x + 16, spr_y, tile_idx + 8, col, 1, 1, top, bottom, clip ); |
| 351 | 404 | } |
| 352 | 405 | if ( y_32 ) |
| 353 | 406 | { |
| 354 | | draw_sprite( bitmap, spr_x, spr_y + 16, tile_idx + 1, col ); |
| 407 | clip &= 0x07; |
| 408 | draw_sprite( bitmap, spr_x, spr_y + 16, tile_idx + 1, col, left, right, 1, 1, clip ); |
| 355 | 409 | if ( x_32 ) |
| 356 | 410 | { |
| 357 | | draw_sprite( bitmap, spr_x + 16, spr_y + 16, tile_idx + 9, col ); |
| 411 | draw_sprite( bitmap, spr_x + 16, spr_y + 16, tile_idx + 9, col, 1, 1, 1, 1, clip ); |
| 358 | 412 | } |
| 359 | 413 | } |
| 360 | 414 | } |