Previous 199869 Revisions Next

r32129 Tuesday 16th September, 2014 at 15:23:14 UTC by O. Galibert
fix blending some more (nw)
[src/mame/drivers]raiden2.c
[src/mame/includes]raiden2.h

trunk/src/mame/includes/raiden2.h
r32128r32129
9191
9292   void common_reset();
9393
94   static UINT16 const raiden_blended_colors[];
95   static UINT16 const xsedae_blended_colors[];
96   static UINT16 const zeroteam_blended_colors[];
97
98   bool blend_active[0x800];
99
94100   tilemap_t *background_layer,*midground_layer,*foreground_layer,*text_layer;
95101   int bg_bank, fg_bank, mid_bank;
96102   UINT16 raiden2_tilemap_enable;
r32128r32129
175181   void blend_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind16 &source, int layer);
176182   void tilemap_draw_and_blend(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, tilemap_t *tilemap);
177183
184   void init_blending(const UINT16 *table);
185
178186   required_device<raiden2cop_device> m_raiden2cop;
179187
180188
trunk/src/mame/drivers/raiden2.c
r32128r32129
944944   if(layer == -1)
945945      return;
946946
947   // Tuned for raiden2
948   const UINT8 alpha_active[0x20] = { // MSB first
949      //00    08    10    18    20    28    30    38    40    48    50    58    60    68    70    78
950      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x3f, 0x73, 0xff, 0x7c, 0xff, 0xff, 0x4f
951   };
952
953947   const pen_t *pens = &m_palette->pen(0);
954948   layer <<= 14;
955949   for(int y = cliprect.min_y; y <= cliprect.max_y; y++) {
r32128r32129
959953         UINT16 val = *src++;
960954         if((val & 0xc000) == layer && (val & 0x000f) != 0x000f) {
961955            val &= 0x07ff;
962            int page = val >> 4;
963            bool active = false;
964            if((val & 0x8) == 0x8 && (alpha_active[page >> 3] & (0x80 >> (page & 7))))
965               active = true;
966956
967            if(page == ccol)
968               active = !active;
969
970            if(active)
957            if(blend_active[val])
971958               *dst = alpha_blend_r32(*dst, pens[val], 0x7f);
972959            else
973960               *dst = pens[val];
r32128r32129
985972
986973UINT32 raiden2_state::screen_update_raiden2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
987974{
988   cnt++;
989   int ocol = ccol;
990
991   if((cnt & 3) == 0) {
992      if (machine().input().code_pressed(KEYCODE_Q))
993         ccol--;
994      if (machine().input().code_pressed(KEYCODE_W))
995         ccol++;
996   }
997   if(ccol == 0x80)
998      ccol = -1;
999   if(ccol == -2)
1000      ccol = 0x7f;
1001
1002   if(ccol != ocol)
1003      popmessage("%02x", ccol);
1004
1005975   bitmap.fill(m_palette->black_pen(), cliprect);
1006976   if (!(raiden2_tilemap_enable & 16)) {
1007977      draw_sprites(cliprect);
r32128r32129
32273197   ROM_REGION( 0x100000, "oki2", ROMREGION_ERASEFF )   /* ADPCM samples */
32283198ROM_END
32293199
3200const UINT16 raiden2_state::raiden_blended_colors[] = {
3201   // bridge tunnel entrance shadow
3202   0x380,
3203
3204   // cloud
3205   0x3c0, 0x3c1, 0x3c2, 0x3c3, 0x3c4, 0x3c5, 0x3c6, 0x3c7, 0x3c8, 0x3c9, 0x3ca, 0x3cb, 0x3cc, 0x3cd, 0x3ce,
3206
3207   // engine
3208   0x3d0, 0x3d1, 0x3d2, 0x3d3, 0x3d4, 0x3d5, 0x3d6, 0x3d7, 0x3d8, 0x3d9, 0x3da, 0x3db, 0x3dc, 0x3dd, 0x3de,
3209
3210   // level 1 boss legs
3211   0x3f0, 0x3f1, 0x3f2, 0x3f3, 0x3f4, 0x3f5, 0x3f6, 0x3f7, 0x3f8, 0x3f9, 0x3fa, 0x3fb, 0x3fc, 0x3fd, 0x3fe,
3212
3213   // water
3214   0x4f8, 0x4f9, 0x4fa, 0x4fb, 0x4fc, 0x4fd, 0x4fe,
3215   0x5c8, 0x5c9, 0x5ca, 0x5cb, 0x5cc, 0x5cd, 0x5ce,
3216
3217   // wall shadow
3218   0x5de,
3219
3220   // house shadow
3221   0x5fe,
3222
3223   // water and trees
3224   0x6c8, 0x6c9, 0x6ca, 0x6cb, 0x6cc, 0x6cd, 0x6ce,
3225   0x6d8, 0x6d9, 0x6da, 0x6db, 0x6dc, 0x6dd, 0x6de,
3226   0x6e8, 0x6e9, 0x6ea, 0x6eb, 0x6ec, 0x6ed, 0x6ee,
3227   0x6f8, 0x6f9, 0x6fa, 0x6fb, 0x6fc, 0x6fd, 0x6fe,
3228
3229   // stage end panel plus misc stuff
3230   0x70d, 0x70e,
3231   0x71c,
3232   0x71d, 0x71e,
3233   0x72d, 0x72e,
3234   0x73d, 0x73e,
3235   0x74d, 0x74e,
3236   0x75c,
3237   0x76d, 0x76e,
3238   0x77d, 0x77e,
3239
3240   // logo in attract mode
3241   0x7c8, 0x7c9, 0x7ca, 0x7cb, 0x7cc, 0x7cd, 0x7ce,
3242
3243   0xffff,
3244};
3245
3246void raiden2_state::init_blending(const UINT16 *table)
3247{
3248   for(int i=0; i<0x800; i++)
3249      blend_active[i] = false;
3250   while(*table != 0xffff)
3251      blend_active[*table++] = true;
3252}
3253
32303254DRIVER_INIT_MEMBER(raiden2_state,raiden2)
32313255{
3256   init_blending(raiden_blended_colors);
32323257   static const int spri[5] = { 0, 1, 2, 3, -1 };
32333258   cur_spri = spri;
32343259   membank("mainbank1")->configure_entries(0, 4, memregion("mainprg")->base(), 0x10000);
r32128r32129
32383263
32393264DRIVER_INIT_MEMBER(raiden2_state,raidendx)
32403265{
3266   init_blending(raiden_blended_colors);
32413267   static const int spri[5] = { 0, 1, 2, 3, -1 };
32423268   cur_spri = spri;
32433269   membank("mainbank1")->configure_entries(0, 0x20, memregion("mainprg")->base(), 0x10000);
r32128r32129
32453271   raiden2_decrypt_sprites(machine());
32463272}
32473273
3274const UINT16 raiden2_state::xsedae_blended_colors[] = {
3275   0xffff,
3276};
3277
32483278DRIVER_INIT_MEMBER(raiden2_state,xsedae)
32493279{
3250   static const int spri[5] = { 0, 1, 2, 3, -1 };
3280   init_blending(xsedae_blended_colors);
3281   static const int spri[5] = { -1, 0, 1, 2, 3 };
32513282   cur_spri = spri;
32523283   /* doesn't have banking */
32533284}
32543285
32553286DRIVER_INIT_MEMBER(raiden2_state,zeroteam)
32563287{
3288   init_blending(xsedae_blended_colors);
32573289   static const int spri[5] = { -1, 0, 1, 2, 3 };
32583290   cur_spri = spri;
32593291   membank("mainbank1")->configure_entries(0, 4, memregion("mainprg")->base(), 0x10000);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team