Previous 15994 Revisions Next

r15927 Thursday 16th August, 2012 at 16:34:54 UTC by Angelo Salese
Proper priority system for sprites
[src/mess/drivers]vboy.c

src/mess/drivers/vboy.c
r15926r15927
694694   }
695695}
696696
697static UINT8 display_world(vboy_state *state, int num, bitmap_ind16 &bitmap, bool right)
697static UINT8 display_world(vboy_state *state, int num, bitmap_ind16 &bitmap, bool right, int &cur_spt)
698698{
699699   num <<= 4;
700700   UINT16 def = state->m_world[num];
701   UINT8 lon = (def >> 15) & 1;
702   //UINT8 ron = (def >> 14) & 1;
701703   INT16 gx  = state->m_world[num+1];
702704   INT16 gp  = state->m_world[num+2];
703705   INT16 gy  = state->m_world[num+3];
r15926r15927
774776   else
775777   if (mode==3)
776778   {
777      int cur_spt;
779      int start_offs, end_offs;
778780
779      for(cur_spt = 3; cur_spt >= 0;cur_spt--)
781      if(cur_spt == -1)
780782      {
781         int start_offs, end_offs;
783         popmessage("Cur spt used with -1 pointer!");
784         return 0;
785      }
782786
783         start_offs = state->m_vip_regs.SPT[cur_spt];
787      start_offs = state->m_vip_regs.SPT[cur_spt];
784788
785         end_offs = 0x3ff;
786         if(cur_spt != 0)
787            end_offs = state->m_vip_regs.SPT[cur_spt-1];
789      end_offs = 0x3ff;
790      if(cur_spt != 0)
791         end_offs = state->m_vip_regs.SPT[cur_spt-1];
788792
789         i = start_offs;
793      i = start_offs;
794      do
795      {
796         UINT16 start_ndx = i * 4;
797         INT16 jx = state->m_objects[start_ndx+0];
798         INT16 jp = state->m_objects[start_ndx+1] & 0x3fff;
799         INT16 jy = state->m_objects[start_ndx+2] & 0x1ff;
800         UINT16 val = state->m_objects[start_ndx+3];
801         UINT8 jlon = (state->m_objects[start_ndx+1] & 0x8000) >> 15;
802         UINT8 jron = (state->m_objects[start_ndx+1] & 0x4000) >> 14;
790803
791         do
792         {
793            UINT16 start_ndx = i * 4;
794            INT16 jx = state->m_objects[start_ndx+0];
795            INT16 jp = state->m_objects[start_ndx+1] & 0x3fff;
796            INT16 jy = state->m_objects[start_ndx+2] & 0x1ff;
797            UINT16 val = state->m_objects[start_ndx+3];
798            UINT8 jlon = (state->m_objects[start_ndx+1] & 0x8000) >> 15;
799            UINT8 jron = (state->m_objects[start_ndx+1] & 0x4000) >> 14;
804         if (!right && jlon)
805            put_char(state, bitmap, (jx-jp) & 0x1ff, jy, val & 0x7ff, BIT(val,13), BIT(val,12), true, state->m_vip_regs.JPLT[(val>>14) & 3]);
800806
801            if (!right && jlon)
802               put_char(state, bitmap, (jx-jp) & 0x1ff, jy, val & 0x7ff, BIT(val,13), BIT(val,12), true, state->m_vip_regs.JPLT[(val>>14) & 3]);
807         if(right && jron)
808            put_char(state, bitmap, (jx+jp) & 0x1ff, jy, val & 0x7ff, BIT(val,13), BIT(val,12), true, state->m_vip_regs.JPLT[(val>>14) & 3]);
803809
804            if(right && jron)
805               put_char(state, bitmap, (jx+jp) & 0x1ff, jy, val & 0x7ff, BIT(val,13), BIT(val,12), true, state->m_vip_regs.JPLT[(val>>14) & 3]);
810         i --;
811         i &= 0x3ff;
812      }while(i != end_offs);
806813
807            i --;
808            i &= 0x3ff;
809         }while(i != end_offs);
810      }
814      if((lon && !right) /*|| (ron && right)*/)
815         cur_spt --;
811816   }
812817
813818   return 0;
r15926r15927
817822{
818823   vboy_state *state = screen.machine().driver_data<vboy_state>();
819824   state->m_screen_output.fill(state->m_vip_regs.BKCOL, cliprect);
825   int cur_spt;
820826
827   cur_spt = 3;
821828   for(int i=31; i>=0; i--)
822      if (display_world(state, i, state->m_screen_output, 0)) break;
829      if (display_world(state, i, state->m_screen_output, 0,cur_spt)) break;
823830
824831   copybitmap(bitmap, state->m_screen_output, 0, 0, 0, 0, cliprect);
825832   return 0;
r15926r15927
829836{
830837   vboy_state *state = screen.machine().driver_data<vboy_state>();
831838   state->m_screen_output.fill(state->m_vip_regs.BKCOL, cliprect);
839   int cur_spt;
832840
841   cur_spt = 3;
833842   for(int i=31; i>=0; i--)
834      if (display_world(state, i, state->m_screen_output, 1)) break;
843      if (display_world(state, i, state->m_screen_output, 1,cur_spt)) break;
835844
836845   copybitmap(bitmap, state->m_screen_output, 0, 0, 0, 0, cliprect);
837846   return 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team