Previous 199869 Revisions Next

r40081 Thursday 30th July, 2015 at 12:18:42 UTC by Dirk Best
jollyjgr: use standard 3-bit rgb palette for the bitmap colors
[src/mame/drivers]jollyjgr.c

trunk/src/mame/drivers/jollyjgr.c
r248592r248593
116116      m_bulletram(*this, "bulletram"),
117117      m_maincpu(*this, "maincpu"),
118118      m_gfxdecode(*this, "gfxdecode"),
119      m_palette(*this, "palette") { }
119      m_palette(*this, "palette"),
120      m_bm_palette(*this, "bm_palette") { }
120121
121122   /* memory pointers */
122123   required_shared_ptr<UINT8> m_videoram;
r248592r248593
144145   virtual void machine_reset();
145146   virtual void video_start();
146147   DECLARE_PALETTE_INIT(jollyjgr);
147   UINT32 screen_update_jollyjgr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
148   UINT32 screen_update_fspider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
148   UINT32 screen_update_jollyjgr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
149   UINT32 screen_update_fspider(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
149150   INTERRUPT_GEN_MEMBER(jollyjgr_interrupt);
150   void draw_bitmap( bitmap_ind16 &bitmap );
151   void draw_bitmap( bitmap_rgb32 &bitmap );
151152   required_device<cpu_device> m_maincpu;
152153   required_device<gfxdecode_device> m_gfxdecode;
153154   required_device<palette_device> m_palette;
155   required_device<palette_device> m_bm_palette;
154156};
155157
156158
r248592r248593
415417 *
416418 *************************************/
417419
420/* tilemap / sprites palette */
418421PALETTE_INIT_MEMBER(jollyjgr_state, jollyjgr)
419422{
420423   const UINT8 *color_prom = memregion("proms")->base();
421   int i;
422424
423   /* tilemap / sprites palette */
424   for (i = 0; i < 32; i++)
425   for (int i = 0; i < 32; i++)
425426   {
426427      int bit0, bit1, bit2, r, g, b;
427428
r248592r248593
443444      palette.set_pen_color(i, rgb_t(r,g,b));
444445      color_prom++;
445446   }
446
447   /* bitmap palette */
448   for (i = 0;i < 8;i++)
449      palette.set_pen_color(32 + i, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
450447}
451448
452449/* Tilemap is the same as in Galaxian */
r248592r248593
465462   m_bg_tilemap->set_scroll_cols(32);
466463}
467464
468void jollyjgr_state::draw_bitmap( bitmap_ind16 &bitmap )
465void jollyjgr_state::draw_bitmap( bitmap_rgb32 &bitmap )
469466{
470467   int x, y, count;
471468   int i, bit0, bit1, bit2;
r248592r248593
486483            if(color)
487484            {
488485               if(m_flip_x && m_flip_y)
489                  bitmap.pix16(y, x * 8 + i) = color + 32;
486                  bitmap.pix32(y, x * 8 + i) = m_bm_palette->pen_color(color);
490487               else if(m_flip_x && !m_flip_y)
491                  bitmap.pix16(255 - y, x * 8 + i) = color + 32;
488                  bitmap.pix32(255 - y, x * 8 + i) = m_bm_palette->pen_color(color);
492489               else if(!m_flip_x && m_flip_y)
493                  bitmap.pix16(y, 255 - x * 8 - i) = color + 32;
490                  bitmap.pix32(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color);
494491               else
495                  bitmap.pix16(255 - y, 255 - x * 8 - i) = color + 32;
492                  bitmap.pix32(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color);
496493            }
497494         }
498495
r248592r248593
501498   }
502499}
503500
504UINT32 jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
501UINT32 jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
505502{
506503   UINT8 *spriteram = m_spriteram;
507504   int offs;
r248592r248593
556553   return 0;
557554}
558555
559UINT32 jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
556UINT32 jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
560557{
561558   // Draw bg and sprites
562559   screen_update_jollyjgr(screen, bitmap, cliprect);
r248592r248593
569566      UINT8 sy=~m_bulletram[offs];
570567      UINT8 sx=~m_bulletram[offs|1];
571568      UINT16 bc=(offs<4)?
572         32+7: // player, white
573         32+3; // enemy, yellow
569         7: // player, white
570         3; // enemy, yellow
574571
575572      if (m_flip_y) sy^=0xff;
576573      if (m_flip_x) sx+=8;
r248592r248593
578575      if (sy>=cliprect.min_y && sy<=cliprect.max_y)
579576         for (int x=sx-4;x<sx;x++)
580577            if (x>=cliprect.min_x && x<=cliprect.max_x)
581               bitmap.pix16(sy, x)=bc;
578               bitmap.pix32(sy, x) = m_bm_palette->pen_color(bc);
582579   }
583580
584581   return 0;
r248592r248593
653650}
654651
655652static MACHINE_CONFIG_START( jollyjgr, jollyjgr_state )
656
657653   /* basic machine hardware */
658654   MCFG_CPU_ADD("maincpu", Z80, 3579545)        /* 3,579545 MHz */
659655   MCFG_CPU_PROGRAM_MAP(jollyjgr_map)
660656   MCFG_CPU_VBLANK_INT_DRIVER("screen", jollyjgr_state,  jollyjgr_interrupt)
661657
662
663658   /* video hardware */
664659   MCFG_SCREEN_ADD("screen", RASTER)
665660   MCFG_SCREEN_REFRESH_RATE(60)
r248592r248593
667662   MCFG_SCREEN_SIZE(256, 256)
668663   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
669664   MCFG_SCREEN_UPDATE_DRIVER(jollyjgr_state, screen_update_jollyjgr)
670   MCFG_SCREEN_PALETTE("palette")
671665
672666   MCFG_GFXDECODE_ADD("gfxdecode", "palette", jollyjgr)
673   MCFG_PALETTE_ADD("palette", 32+8) /* 32 for tilemap and sprites + 8 for the bitmap */
667   MCFG_PALETTE_ADD("palette", 32) // tilemap and sprites
674668   MCFG_PALETTE_INIT_OWNER(jollyjgr_state, jollyjgr)
669   MCFG_PALETTE_ADD_3BIT_RGB("bm_palette") // bitmap
675670
676671   /* sound hardware */
677672   MCFG_SPEAKER_STANDARD_MONO("mono")
r248592r248593
681676MACHINE_CONFIG_END
682677
683678static MACHINE_CONFIG_DERIVED( fspider, jollyjgr )
684
685679   MCFG_CPU_MODIFY("maincpu")
686680   MCFG_CPU_PROGRAM_MAP(fspider_map)
687681
688682   MCFG_SCREEN_MODIFY("screen")
689683   MCFG_SCREEN_UPDATE_DRIVER(jollyjgr_state, screen_update_fspider)
690
691684MACHINE_CONFIG_END
692685
693686/*************************************


Previous 199869 Revisions Next


© 1997-2024 The MAME Team