trunk/src/mame/drivers/vamphalf.c
r241450 | r241451 | |
167 | 167 | DECLARE_WRITE32_MEMBER(yorizori_1c_w); |
168 | 168 | DECLARE_READ32_MEMBER(yorizori_10_r); |
169 | 169 | |
170 | | |
171 | | |
172 | 170 | DECLARE_READ8_MEMBER(qs1000_p1_r); |
173 | 171 | DECLARE_WRITE8_MEMBER(qs1000_p3_w); |
174 | 172 | DECLARE_DRIVER_INIT(vamphalf); |
r241450 | r241451 | |
192 | 190 | DECLARE_DRIVER_INIT(yorizori); |
193 | 191 | UINT32 screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
194 | 192 | UINT32 screen_update_aoh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 193 | void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap); |
| 194 | void draw_sprites_aoh(screen_device &screen, bitmap_ind16 &bitmap); |
| 195 | void handle_flipped_visible_area(screen_device &screen); |
195 | 196 | }; |
196 | 197 | |
197 | 198 | READ16_MEMBER(vamphalf_state::eeprom_r) |
r241450 | r241451 | |
608 | 609 | Offset+3 |
609 | 610 | -------x xxxxxxxx X offs |
610 | 611 | */ |
611 | | static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap) |
| 612 | void vamphalf_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap) |
612 | 613 | { |
613 | | vamphalf_state *state = screen.machine().driver_data<vamphalf_state>(); |
614 | | gfx_element *gfx = state->m_gfxdecode->gfx(0); |
| 614 | gfx_element *gfx = m_gfxdecode->gfx(0); |
615 | 615 | UINT32 cnt; |
616 | 616 | int block, offs; |
617 | 617 | int code,color,x,y,fx,fy; |
r241450 | r241451 | |
622 | 622 | |
623 | 623 | for (block=0; block<0x8000; block+=0x800) |
624 | 624 | { |
625 | | if(state->m_flipscreen) |
| 625 | if(m_flipscreen) |
626 | 626 | { |
627 | 627 | clip.min_y = 256 - (16-(block/0x800))*16; |
628 | 628 | clip.max_y = 256 - ((16-(block/0x800))*16)+15; |
r241450 | r241451 | |
644 | 644 | offs = (block + cnt) / 2; |
645 | 645 | |
646 | 646 | // 16bit version |
647 | | if(state->m_tiles != NULL) |
| 647 | if(m_tiles != NULL) |
648 | 648 | { |
649 | | if(state->m_tiles[offs] & 0x0100) continue; |
| 649 | if(m_tiles[offs] & 0x0100) continue; |
650 | 650 | |
651 | | code = state->m_tiles[offs+1]; |
652 | | color = (state->m_tiles[offs+2] >> state->m_palshift) & 0x7f; |
| 651 | code = m_tiles[offs+1]; |
| 652 | color = (m_tiles[offs+2] >> m_palshift) & 0x7f; |
653 | 653 | |
654 | 654 | // boonggab |
655 | | if(state->m_has_extra_gfx) |
| 655 | if(m_has_extra_gfx) |
656 | 656 | { |
657 | | code |= ((state->m_tiles[offs+2] & 0x100) << 8); |
| 657 | code |= ((m_tiles[offs+2] & 0x100) << 8); |
658 | 658 | } |
659 | 659 | |
660 | | x = state->m_tiles[offs+3] & 0x01ff; |
661 | | y = 256 - (state->m_tiles[offs] & 0x00ff); |
| 660 | x = m_tiles[offs+3] & 0x01ff; |
| 661 | y = 256 - (m_tiles[offs] & 0x00ff); |
662 | 662 | |
663 | | fx = state->m_tiles[offs] & 0x8000; |
664 | | fy = state->m_tiles[offs] & 0x4000; |
| 663 | fx = m_tiles[offs] & 0x8000; |
| 664 | fy = m_tiles[offs] & 0x4000; |
665 | 665 | } |
666 | 666 | // 32bit version |
667 | 667 | else |
668 | 668 | { |
669 | 669 | offs /= 2; |
670 | 670 | |
671 | | if(state->m_tiles32[offs] & 0x01000000) continue; |
| 671 | if(m_tiles32[offs] & 0x01000000) continue; |
672 | 672 | |
673 | | code = state->m_tiles32[offs] & 0xffff; |
674 | | color = ((state->m_tiles32[offs+1] >> state->m_palshift) & 0x7f0000) >> 16; |
| 673 | code = m_tiles32[offs] & 0xffff; |
| 674 | color = ((m_tiles32[offs+1] >> m_palshift) & 0x7f0000) >> 16; |
675 | 675 | |
676 | | x = state->m_tiles32[offs+1] & 0x01ff; |
677 | | y = 256 - ((state->m_tiles32[offs] & 0x00ff0000) >> 16); |
| 676 | x = m_tiles32[offs+1] & 0x01ff; |
| 677 | y = 256 - ((m_tiles32[offs] & 0x00ff0000) >> 16); |
678 | 678 | |
679 | | fx = state->m_tiles32[offs] & 0x80000000; |
680 | | fy = state->m_tiles32[offs] & 0x40000000; |
| 679 | fx = m_tiles32[offs] & 0x80000000; |
| 680 | fy = m_tiles32[offs] & 0x40000000; |
681 | 681 | } |
682 | 682 | |
683 | | if(state->m_flipscreen) |
| 683 | if(m_flipscreen) |
684 | 684 | { |
685 | 685 | fx = !fx; |
686 | 686 | fy = !fy; |
r241450 | r241451 | |
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
697 | | static void draw_sprites_aoh(screen_device &screen, bitmap_ind16 &bitmap) |
| 697 | void vamphalf_state::draw_sprites_aoh(screen_device &screen, bitmap_ind16 &bitmap) |
698 | 698 | { |
699 | | vamphalf_state *state = screen.machine().driver_data<vamphalf_state>(); |
700 | | gfx_element *gfx = state->m_gfxdecode->gfx(0); |
| 699 | gfx_element *gfx = m_gfxdecode->gfx(0); |
701 | 700 | UINT32 cnt; |
702 | 701 | int block, offs; |
703 | 702 | int code,color,x,y,fx,fy; |
r241450 | r241451 | |
708 | 707 | |
709 | 708 | for (block=0; block<0x8000; block+=0x800) |
710 | 709 | { |
711 | | if(state->m_flipscreen) |
| 710 | if(m_flipscreen) |
712 | 711 | { |
713 | 712 | clip.min_y = 256 - (16-(block/0x800))*16; |
714 | 713 | clip.max_y = 256 - ((16-(block/0x800))*16)+15; |
r241450 | r241451 | |
731 | 730 | offs = (block + cnt) / 2; |
732 | 731 | { |
733 | 732 | offs /= 2; |
734 | | code = (state->m_tiles32[offs] & 0xffff) | ((state->m_tiles32[offs] & 0x3000000) >> 8); |
735 | | color = ((state->m_tiles32[offs+1] >> state->m_palshift) & 0x7f0000) >> 16; |
| 733 | code = (m_tiles32[offs] & 0xffff) | ((m_tiles32[offs] & 0x3000000) >> 8); |
| 734 | color = ((m_tiles32[offs+1] >> m_palshift) & 0x7f0000) >> 16; |
736 | 735 | |
737 | | x = state->m_tiles32[offs+1] & 0x01ff; |
738 | | y = 256 - ((state->m_tiles32[offs] & 0x00ff0000) >> 16); |
| 736 | x = m_tiles32[offs+1] & 0x01ff; |
| 737 | y = 256 - ((m_tiles32[offs] & 0x00ff0000) >> 16); |
739 | 738 | |
740 | | fx = state->m_tiles32[offs] & 0x4000000; |
741 | | fy = 0; // not used ? or it's state->m_tiles32[offs] & 0x8000000? |
| 739 | fx = m_tiles32[offs] & 0x4000000; |
| 740 | fy = 0; // not used ? or it's m_tiles32[offs] & 0x8000000? |
742 | 741 | } |
743 | 742 | |
744 | | if(state->m_flipscreen) |
| 743 | if(m_flipscreen) |
745 | 744 | { |
746 | 745 | fx = !fx; |
747 | 746 | fy = !fy; |
r241450 | r241451 | |
756 | 755 | } |
757 | 756 | |
758 | 757 | |
759 | | void vamphalf_handle_flipped_visible_area( screen_device &screen ) |
| 758 | void vamphalf_state::handle_flipped_visible_area( screen_device &screen ) |
760 | 759 | { |
761 | | vamphalf_state *state = screen.machine().driver_data<vamphalf_state>(); |
762 | 760 | // are there actually registers to handle this? |
763 | | if(!state->m_flipscreen) |
| 761 | if(!m_flipscreen) |
764 | 762 | { |
765 | 763 | rectangle visarea; |
766 | 764 | visarea.set(31, 350, 16, 251); |
r241450 | r241451 | |
777 | 775 | |
778 | 776 | UINT32 vamphalf_state::screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
779 | 777 | { |
780 | | vamphalf_handle_flipped_visible_area(screen); |
| 778 | handle_flipped_visible_area(screen); |
781 | 779 | bitmap.fill(0, cliprect); |
782 | 780 | draw_sprites(screen, bitmap); |
783 | 781 | return 0; |
r241450 | r241451 | |
785 | 783 | |
786 | 784 | UINT32 vamphalf_state::screen_update_aoh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
787 | 785 | { |
788 | | // vamphalf_handle_flipped_visible_area(screen); // not on this? |
| 786 | // handle_flipped_visible_area(screen); // not on this? |
789 | 787 | bitmap.fill(0, cliprect); |
790 | 788 | draw_sprites_aoh(screen, bitmap); |
791 | 789 | return 0; |