Previous 199869 Revisions Next

r31920 Friday 5th September, 2014 at 14:51:50 UTC by O. Galibert
raiden2: sprite placement and priorities (nw)
[src/mame/drivers]raiden2.c
[src/mame/includes]raiden2.h

trunk/src/mame/includes/raiden2.h
r31919r31920
139139   UINT16 cop_hit_status;
140140   INT16 cop_hit_val_x,cop_hit_val_y,cop_hit_val_z,cop_hit_val_unk;
141141
142   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ,int pri_mask );
142   void draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &priority, const rectangle &cliprect);
143143   UINT8 cop_calculate_collsion_detection();
144144   void cop_take_hit_box_params(UINT8 offs);
145145
trunk/src/mame/drivers/raiden2.c
r31919r31920
799799
800800/* SPRITE DRAWING (move to video file) */
801801
802void raiden2_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ,int pri_mask )
802void raiden2_state::draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &priority, const rectangle &cliprect)
803803{
804   UINT16 *source = sprites + sprites_cur_start/2 - 4;
804   UINT16 *source = sprites;
805805
806806   gfx_element *gfx = m_gfxdecode->gfx(2);
807807
808//  static int ytlim = 1;
809//  static int xtlim = 1;
810
811//  if ( machine.input().code_pressed_once(KEYCODE_Q) ) ytlim--;
812//  if ( machine.input().code_pressed_once(KEYCODE_W) ) ytlim++;
813
814//  if ( machine.input().code_pressed_once(KEYCODE_A) ) xtlim--;
815//  if ( machine.input().code_pressed_once(KEYCODE_S) ) xtlim++;
816
817
818   /*00 ???? ????  (colour / priority?)
819     01 fhhh Fwww   h = height f=flipy w = width F = flipx
820     02 nnnn nnnn   n = tileno
821     03 nnnn nnnn   n = tileno
822     04 xxxx xxxx   x = xpos
823     05 xxxx xxxx   x = xpos
824     06 yyyy yyyy   y = ypos
825     07 yyyy yyyy   y = ypos
826
808   /*
809     00 fhhh Fwww ppcc cccc   h = height f=flipy w = width F = flipx p = priority c = color
810     02 nnnn nnnn nnnn nnnn   n = tileno
811     04 xxxx xxxx xxxx xxxx   x = xpos
812     06 yyyy yyyy yyyy yyyy   y = ypos
827813    */
828814
829
830   while( source>sprites ){
815   while( source<sprites + sprites_cur_start/2 ){
831816      int tile_number = source[1];
832817      int sx = source[2];
833818      int sy = source[3];
r31919r31920
836821      int ytlim, xtlim;
837822      int xflip, yflip;
838823      int xstep, ystep;
824      int pri, pri_mask;
839825
840
841826      ytlim = (source[0] >> 12) & 0x7;
842      xtlim = (source[0] >> 8) & 0x7;
827      xtlim = (source[0] >> 8 ) & 0x7;
843828
844829      xflip = (source[0] >> 15) & 0x1;
845830      yflip = (source[0] >> 11) & 0x1;
846831
847832      colr = source[0] & 0x3f;
848833
834      static const UINT32 pri_masks[5] = { 0xfffe, 0xfffc, 0xfff0, 0xff00 };
835      pri = (source[0] >> 6) & 3;
836      pri_mask = pri_masks[pri];
837
849838      ytlim += 1;
850839      xtlim += 1;
851840
r31919r31920
875864
876865
877866
878                  gfx->transpen(
867                  gfx->prio_transpen(
879868                  bitmap,
880869                  cliprect,
881870                  tile_number,
882871                  colr,
883872                  yflip,xflip,
884                  (sx+xstep*xtiles)&ZEROTEAM_MASK_X,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y,15);
873                  (sx+xstep*xtiles)&ZEROTEAM_MASK_X,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y, priority, pri_mask, 15);
885874
886875
887                  gfx->transpen(
876                  gfx->prio_transpen(
888877                  bitmap,
889878                  cliprect,
890879                  tile_number,
891880                  colr,
892881                  yflip,xflip,
893                  ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y,15);
882                  ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,(sy+ystep*ytiles)&ZEROTEAM_MASK_Y, priority, pri_mask, 15);
894883
895884
896                  gfx->transpen(
885                  gfx->prio_transpen(
897886                  bitmap,
898887                  cliprect,
899888                  tile_number,
900889                  colr,
901890                  yflip,xflip,
902                  (sx+xstep*xtiles)&ZEROTEAM_MASK_X,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200,15);
891                  (sx+xstep*xtiles)&ZEROTEAM_MASK_X,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200, priority, pri_mask, 15);
903892
904893
905                  gfx->transpen(
894                  gfx->prio_transpen(
906895                  bitmap,
907896                  cliprect,
908897                  tile_number,
909898                  colr,
910899                  yflip,xflip,
911                  ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200,15);
900                  ((sx+xstep*xtiles)&ZEROTEAM_MASK_X)-0x200,((sy+ystep*ytiles)&ZEROTEAM_MASK_Y)-0x200, priority, pri_mask, 15);
912901
913902
914903            tile_number++;
915904         }
916905      }
917906
918      source-=4;
907      source += 4;
919908   }
920909
921910}
r31919r31920
10841073UINT32 raiden2_state::screen_update_raiden2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
10851074{
10861075   bitmap.fill(m_palette->black_pen(), cliprect);
1076   screen.priority().fill(0, cliprect);
10871077
1088   //if (!machine().input().code_pressed(KEYCODE_Q))
1089   {
1090      if (!(raiden2_tilemap_enable & 1))
1091         background_layer->draw(screen, bitmap, cliprect, 0, 0);
1092   }
1078   if (!(raiden2_tilemap_enable & 1))
1079      background_layer->draw(screen, bitmap, cliprect, 0, 1);
10931080
1094   //if (!machine().input().code_pressed(KEYCODE_W))
1095   {
1096      if (!(raiden2_tilemap_enable & 2))
1097         midground_layer->draw(screen, bitmap, cliprect, 0, 0);
1098   }
1081   if (!(raiden2_tilemap_enable & 2))
1082      midground_layer->draw(screen, bitmap, cliprect, 0, 2);
10991083
1100   //if (!machine().input().code_pressed(KEYCODE_E))
1101   {
1102      if (!(raiden2_tilemap_enable & 4))
1103         foreground_layer->draw(screen, bitmap, cliprect, 0, 0);
1104   }
1084   if (!(raiden2_tilemap_enable & 4))
1085      foreground_layer->draw(screen, bitmap, cliprect, 0, 4);
11051086
1106   //if (!machine().input().code_pressed(KEYCODE_S))
1107   {
1108      if (!(raiden2_tilemap_enable & 0x10))
1109         draw_sprites(bitmap, cliprect, 0);
1110   }
1087   if (!(raiden2_tilemap_enable & 8))
1088      text_layer->draw(screen, bitmap, cliprect, 0, 8);
11111089
1112   //if (!machine().input().code_pressed(KEYCODE_A))
1113   {
1114      if (!(raiden2_tilemap_enable & 8))
1115         text_layer->draw(screen, bitmap, cliprect, 0, 0);
1116   }
1090   if (!(raiden2_tilemap_enable & 0x10))
1091      draw_sprites(bitmap, screen.priority(), cliprect);
11171092
11181093   return 0;
11191094}
r31919r31920
13541329
13551330   UINT16 head1 = space.read_word(src+0x60);
13561331   UINT16 head2 = space.read_word(src+0x62);
1357   UINT16 oxy   = space.read_word(src+0x66);
13581332
13591333   int w = (((head1 >> 8 ) & 7) + 1) << 3;
13601334   int h = (((head1 >> 12) & 7) + 1) << 3;
13611335
1362   int ox = INT8(oxy);
1363   int oy = INT8(oxy >> 8);
1364
1365   UINT16 flag = x-ox > -w && x-ox < cop_spr_maxx+w && y-oy > -h && y-oy < 240+h ? 1 : 0;
1336   UINT16 flag = x-w > -w && x-w < cop_spr_maxx+w && y-h > -h && y-h < 240+h ? 1 : 0;
13661337   
13671338   flag = (space.read_word(src) & 0xfffe) | flag;
13681339   space.write_word(src, flag);
r31919r31920
13711342   {
13721343      space.write_word(dst1,   head1);
13731344      space.write_word(dst1+2, head2);
1374      space.write_word(dst1+4, x-ox);
1375      space.write_word(dst1+6, y-oy);
1345      space.write_word(dst1+4, x-w);
1346      space.write_word(dst1+6, y-h);
13761347
13771348      dst1 += 8;
13781349   }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team