trunk/src/mame/drivers/gunpey.c
| r21579 | r21580 | |
| 307 | 307 | |
| 308 | 308 | UINT8 sourcewidth = (m_wram[count+6] & 0xff); |
| 309 | 309 | UINT8 sourceheight = (m_wram[count+7] >> 8); |
| 310 | | |
| 311 | | //UINT32 col = 0xffffff; |
| 312 | | // UINT32 val = (m_wram[count+1] << 16) | ((m_wram[count+2])); |
| 313 | 310 | int xsource = ((m_wram[count+2] & 0x003f) << 5) | ((m_wram[count+1] & 0xf800) >> 11); |
| 314 | 311 | int ysource = ((m_wram[count+3] & 0x001f) << 6) | ((m_wram[count+2] & 0xfc00) >> 10); |
| 315 | | //printf("%08x %04x %04x\n", val, m_wram[count+1],m_wram[count+2] ); |
| 316 | | // UINT16 xsource = (m_wram[count+2] & 0x00ff << 4) | (m_wram[count+1] & 0xf000 >> 12); |
| 317 | | //xsource<<=1; |
| 318 | 312 | |
| 319 | | // xsource<<=1; |
| 320 | | // ysource <<=2; |
| 313 | int alpha = m_wram[count+1] & 0x1f; |
| 321 | 314 | |
| 322 | | // UINT8 testhack = m_vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+0)&0x7ff))]; |
| 323 | | // UINT8 testhack2 = m_vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+1)&0x7ff))]; |
| 324 | 315 | |
| 325 | | //if (m_wram[count+1] & 0x0010) |
| 326 | | // color = machine.rand()&0xf; |
| 327 | | |
| 328 | | |
| 329 | | |
| 330 | | |
| 331 | 316 | UINT16 unused; |
| 332 | 317 | if (debug) printf("sprite %04x %04x %04x %04x %04x %04x %04x %04x\n", m_wram[count+0], m_wram[count+1], m_wram[count+2], m_wram[count+3], m_wram[count+4], m_wram[count+5], m_wram[count+6], m_wram[count+7]); |
| 333 | 318 | |
| r21579 | r21580 | |
| 345 | 330 | //printf("zoomed widths %02x %02x heights %02x %02x\n", sourcewidth, zoomwidth, sourceheight, zoomheight); |
| 346 | 331 | } |
| 347 | 332 | |
| 348 | | |
| 349 | | |
| 350 | | // if ((testhack2 & 0x0f) == 0x08) |
| 351 | | // return m_wram[count+0] & 0x80; |
| 352 | | |
| 353 | | //if (debug) printf("testhack1 %02x %02x\n", testhack, testhack2); |
| 354 | | |
| 355 | 333 | if(bpp_sel == 0x00) // 4bpp |
| 356 | 334 | { |
| 357 | 335 | for(int yi=0;yi<sourceheight;yi++) |
| r21579 | r21580 | |
| 388 | 366 | } |
| 389 | 367 | |
| 390 | 368 | if(cliprect.contains(x+(xi*2), y+yi)) |
| 391 | | bitmap.pix16(y+yi, x+(xi*2)) = color_data & 0x7fff; |
| 369 | { |
| 370 | if (alpha==0x00) // a value of 0x00 is solid |
| 371 | { |
| 372 | bitmap.pix16(y+yi, x+(xi*2)) = color_data & 0x7fff; |
| 373 | } |
| 374 | else |
| 375 | { |
| 376 | UINT16 basecolor = bitmap.pix16(y+yi, x+(xi*2)); |
| 377 | int base_r = ((basecolor >> 10)&0x1f)*alpha; |
| 378 | int base_g = ((basecolor >> 5)&0x1f)*alpha; |
| 379 | int base_b = ((basecolor >> 0)&0x1f)*alpha; |
| 380 | int r = ((color_data & 0x7c00) >> 10)*(0x1f-alpha); |
| 381 | int g = ((color_data & 0x03e0) >> 5)*(0x1f-alpha); |
| 382 | int b = ((color_data & 0x001f) >> 0)*(0x1f-alpha); |
| 383 | r = (base_r+r)/0x1f; |
| 384 | g = (base_g+g)/0x1f; |
| 385 | b = (base_b+b)/0x1f; |
| 386 | color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); |
| 387 | bitmap.pix16(y+yi, x+(xi*2)) = color_data & 0x7fff; |
| 388 | } |
| 389 | } |
| 392 | 390 | } |
| 393 | 391 | |
| 394 | 392 | pix = (data & 0xf0)>>4; |
| r21579 | r21580 | |
| 415 | 413 | color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); |
| 416 | 414 | } |
| 417 | 415 | |
| 418 | | if(cliprect.contains(x+1+(xi*2), y+yi)) |
| 419 | | bitmap.pix16(y+yi, x+1+(xi*2)) = color_data & 0x7fff; |
| 416 | if(cliprect.contains(x+1+(xi*2),y+yi)) |
| 417 | { |
| 418 | if (alpha==0x00) // a value of 0x00 is solid |
| 419 | { |
| 420 | bitmap.pix16(y+yi, x+1+(xi*2)) = color_data & 0x7fff; |
| 421 | } |
| 422 | else |
| 423 | { |
| 424 | UINT16 basecolor = bitmap.pix16(y+yi, x+1+(xi*2)); |
| 425 | int base_r = ((basecolor >> 10)&0x1f)*alpha; |
| 426 | int base_g = ((basecolor >> 5)&0x1f)*alpha; |
| 427 | int base_b = ((basecolor >> 0)&0x1f)*alpha; |
| 428 | int r = ((color_data & 0x7c00) >> 10)*(0x1f-alpha); |
| 429 | int g = ((color_data & 0x03e0) >> 5)*(0x1f-alpha); |
| 430 | int b = ((color_data & 0x001f) >> 0)*(0x1f-alpha); |
| 431 | r = (base_r+r)/0x1f; |
| 432 | g = (base_g+g)/0x1f; |
| 433 | b = (base_b+b)/0x1f; |
| 434 | color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); |
| 435 | bitmap.pix16(y+yi, x+1+(xi*2)) = color_data & 0x7fff; |
| 436 | } |
| 437 | |
| 438 | } |
| 439 | |
| 420 | 440 | } |
| 421 | 441 | } |
| 422 | 442 | } |
| r21579 | r21580 | |
| 476 | 496 | color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); |
| 477 | 497 | } |
| 478 | 498 | |
| 479 | | if(cliprect.contains(x+xi, y+yi)) |
| 480 | | bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; |
| 499 | |
| 500 | |
| 501 | if(cliprect.contains(x+xi,y+yi)) |
| 502 | { |
| 503 | if (alpha==0x00) // a value of 0x00 is solid |
| 504 | { |
| 505 | bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; |
| 506 | } |
| 507 | else |
| 508 | { |
| 509 | UINT16 basecolor = bitmap.pix16(y+yi, x+xi); |
| 510 | int base_r = ((basecolor >> 10)&0x1f)*alpha; |
| 511 | int base_g = ((basecolor >> 5)&0x1f)*alpha; |
| 512 | int base_b = ((basecolor >> 0)&0x1f)*alpha; |
| 513 | int r = ((color_data & 0x7c00) >> 10)*(0x1f-alpha); |
| 514 | int g = ((color_data & 0x03e0) >> 5)*(0x1f-alpha); |
| 515 | int b = ((color_data & 0x001f) >> 0)*(0x1f-alpha); |
| 516 | r = (base_r+r)/0x1f; |
| 517 | g = (base_g+g)/0x1f; |
| 518 | b = (base_b+b)/0x1f; |
| 519 | color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); |
| 520 | bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; |
| 521 | } |
| 522 | |
| 523 | } |
| 524 | |
| 481 | 525 | } |
| 482 | 526 | } |
| 483 | 527 | } |