Previous 199869 Revisions Next

r32939 Saturday 25th October, 2014 at 07:16:55 UTC by Osso
vamphalf.c: moved some video functions into driver class (nw)
[src/mame/drivers]vamphalf.c

trunk/src/mame/drivers/vamphalf.c
r241450r241451
167167   DECLARE_WRITE32_MEMBER(yorizori_1c_w);
168168   DECLARE_READ32_MEMBER(yorizori_10_r);
169169
170
171
172170   DECLARE_READ8_MEMBER(qs1000_p1_r);
173171   DECLARE_WRITE8_MEMBER(qs1000_p3_w);
174172   DECLARE_DRIVER_INIT(vamphalf);
r241450r241451
192190   DECLARE_DRIVER_INIT(yorizori);
193191   UINT32 screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
194192   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);
195196};
196197
197198READ16_MEMBER(vamphalf_state::eeprom_r)
r241450r241451
608609Offset+3
609610-------x xxxxxxxx X offs
610611*/
611static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap)
612void vamphalf_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap)
612613{
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);
615615   UINT32 cnt;
616616   int block, offs;
617617   int code,color,x,y,fx,fy;
r241450r241451
622622
623623   for (block=0; block<0x8000; block+=0x800)
624624   {
625      if(state->m_flipscreen)
625      if(m_flipscreen)
626626      {
627627         clip.min_y = 256 - (16-(block/0x800))*16;
628628         clip.max_y = 256 - ((16-(block/0x800))*16)+15;
r241450r241451
644644         offs = (block + cnt) / 2;
645645
646646         // 16bit version
647         if(state->m_tiles != NULL)
647         if(m_tiles != NULL)
648648         {
649            if(state->m_tiles[offs] & 0x0100) continue;
649            if(m_tiles[offs] & 0x0100) continue;
650650
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;
653653
654654            // boonggab
655            if(state->m_has_extra_gfx)
655            if(m_has_extra_gfx)
656656            {
657               code  |= ((state->m_tiles[offs+2] & 0x100) << 8);
657               code  |= ((m_tiles[offs+2] & 0x100) << 8);
658658            }
659659
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);
662662
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;
665665         }
666666         // 32bit version
667667         else
668668         {
669669            offs /= 2;
670670
671            if(state->m_tiles32[offs] & 0x01000000) continue;
671            if(m_tiles32[offs] & 0x01000000) continue;
672672
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;
675675
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);
678678
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;
681681         }
682682
683         if(state->m_flipscreen)
683         if(m_flipscreen)
684684         {
685685            fx = !fx;
686686            fy = !fy;
r241450r241451
694694   }
695695}
696696
697static void draw_sprites_aoh(screen_device &screen, bitmap_ind16 &bitmap)
697void vamphalf_state::draw_sprites_aoh(screen_device &screen, bitmap_ind16 &bitmap)
698698{
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);
701700   UINT32 cnt;
702701   int block, offs;
703702   int code,color,x,y,fx,fy;
r241450r241451
708707
709708   for (block=0; block<0x8000; block+=0x800)
710709   {
711      if(state->m_flipscreen)
710      if(m_flipscreen)
712711      {
713712         clip.min_y = 256 - (16-(block/0x800))*16;
714713         clip.max_y = 256 - ((16-(block/0x800))*16)+15;
r241450r241451
731730         offs = (block + cnt) / 2;
732731         {
733732            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;
736735
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);
739738
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?
742741         }
743742
744         if(state->m_flipscreen)
743         if(m_flipscreen)
745744         {
746745            fx = !fx;
747746            fy = !fy;
r241450r241451
756755}
757756
758757
759void vamphalf_handle_flipped_visible_area( screen_device &screen )
758void vamphalf_state::handle_flipped_visible_area( screen_device &screen )
760759{
761   vamphalf_state *state = screen.machine().driver_data<vamphalf_state>();
762760   // are there actually registers to handle this?
763   if(!state->m_flipscreen)
761   if(!m_flipscreen)
764762   {
765763      rectangle visarea;
766764      visarea.set(31, 350, 16, 251);
r241450r241451
777775
778776UINT32 vamphalf_state::screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
779777{
780   vamphalf_handle_flipped_visible_area(screen);
778   handle_flipped_visible_area(screen);
781779   bitmap.fill(0, cliprect);
782780   draw_sprites(screen, bitmap);
783781   return 0;
r241450r241451
785783
786784UINT32 vamphalf_state::screen_update_aoh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
787785{
788//  vamphalf_handle_flipped_visible_area(screen); // not on this?
786//  handle_flipped_visible_area(screen); // not on this?
789787   bitmap.fill(0, cliprect);
790788   draw_sprites_aoh(screen, bitmap);
791789   return 0;


Previous 199869 Revisions Next


© 1997-2024 The MAME Team