예제 #1
0
        public static void avg_init_palette(int paltype, byte[] palette, ushort[] colortable, _BytePtr color_prom)
        {
            int i, j, k;

            int[] trcl1 = { 0, 0, 2, 2, 1, 1 };
            int[] trcl2 = { 1, 2, 0, 1, 0, 2 };
            int[] trcl3 = { 2, 1, 1, 0, 2, 0 };

            /* initialize the first 8 colors with the basic colors */
            /* Only these are selected by writes to the colorram. */
            for (i = 0; i < 8; i++)
            {
                palette[3 * i] = (byte)((i & RED) != 0 ? 0xff : 0);
                palette[3 * i + 1] = (byte)((i & GREEN) != 0 ? 0xff : 0);
                palette[3 * i + 2] = (byte)((i & BLUE) != 0 ? 0xff : 0);
            }

            /* initialize the colorram */
            for (i = 0; i < 16; i++)
                colorram[i] = i & 0x07;

            /* fill the rest of the 256 color entries depending on the game */
            switch (paltype)
            {
                /* Black and White vector colors (Asteroids,Omega Race) .ac JAN2498 */
                case VEC_PAL_WHITE:
                    shade_fill(palette, RED | GREEN | BLUE, 8, 128 + 8, 0, 255);
                    colorram[1] = 7; /* BW games use only color 1 (== white) */
                    break;

                /* Monochrome Aqua colors (Asteroids Deluxe,Red Baron) .ac JAN2498 */
                case VEC_PAL_ASTDELUX:
                    /* Use backdrop if present MLR OCT0598 */
                    if ((backdrop = Mame.artwork_load("astdelux.png", 32, (int)(Mame.Machine.drv.total_colors - 32))) != null)
                    {
                        shade_fill(palette, GREEN | BLUE, 8, 23, 1, 254);
                        /* Some more anti-aliasing colors. */
                        shade_fill(palette, GREEN | BLUE, 24, 31, 1, 254);
                        for (i = 0; i < 8; i++)
                            palette[(24 + i) * 3] = 80;
                        for (i = 0; i < 3 * backdrop.num_pens_used; i++)
                            palette[i + 3 * backdrop.start_pen] = backdrop.orig_palette[i];
                        //memcpy (palette+3*backdrop.start_pen, backdrop.orig_palette,3*backdrop.num_pens_used);
                    }
                    else
                        shade_fill(palette, GREEN | BLUE, 8, 128 + 8, 1, 254);
                    colorram[1] = 3; /* for Asteroids */
                    break;

                case VEC_PAL_AQUA:
                    shade_fill(palette, GREEN | BLUE, 8, 128 + 8, 1, 254);
                    colorram[0] = 3; /* for Red Baron */
                    break;

                /* Monochrome Green/Red vector colors (Battlezone) .ac JAN2498 */
                case VEC_PAL_BZONE:
                    shade_fill(palette, RED, 8, 23, 1, 254);
                    shade_fill(palette, GREEN, 24, 31, 1, 254);
                    shade_fill(palette, WHITE, 32, 47, 1, 254);
                    /* Use backdrop if present MLR OCT0598 */
                    if ((backdrop = Mame.artwork_load("bzone.png", 48, (int)(Mame.Machine.drv.total_colors - 48))) != null)
                        for (i = 0; i < 3 * backdrop.num_pens_used; i++)
                            palette[3 * backdrop.start_pen + i] = backdrop.orig_palette[i];
                    //memcpy (palette+3*backdrop.start_pen, backdrop.orig_palette, 3*backdrop.num_pens_used);
                    break;

                /* Colored games (Major Havoc, Star Wars, Tempest) .ac JAN2498 */
                case VEC_PAL_MULTI:
                case VEC_PAL_SWARS:
                    /* put in 40 shades for red, blue and magenta */
                    shade_fill(palette, RED, 8, 47, 10, 250);
                    shade_fill(palette, BLUE, 48, 87, 10, 250);
                    shade_fill(palette, RED | BLUE, 88, 127, 10, 250);

                    /* put in 20 shades for yellow and green */
                    shade_fill(palette, GREEN, 128, 147, 10, 250);
                    shade_fill(palette, RED | GREEN, 148, 167, 10, 250);

                    /* and 14 shades for cyan and white */
                    shade_fill(palette, BLUE | GREEN, 168, 181, 10, 250);
                    shade_fill(palette, WHITE, 182, 194, 10, 250);

                    /* Fill in unused gaps with more anti-aliasing colors. */
                    /* There are 60 slots available.           .ac JAN2498 */
                    i = 195;
                    for (j = 0; j < 6; j++)
                    {
                        for (k = 7; k <= 16; k++)
                        {
                            palette[3 * i + trcl1[j]] = (byte)(((256 * k) / 16) - 1);
                            palette[3 * i + trcl2[j]] = (byte)(((128 * k) / 16) - 1);
                            palette[3 * i + trcl3[j]] = 0;
                            i++;
                        }
                    }
                    break;
                default:
                    Mame.printf("Wrong palette type in avgdvg.c");
                    break;
            }
        }
예제 #2
0
        public static void dvg_stop()
        {
            busy = false;
            Vector.vector_clear_list();

            Vector.vector_vh_stop();

            if (backdrop != null) Mame.artwork_free(ref backdrop);
            backdrop = null;
        }
예제 #3
0
        public static void cinemat_init_colors(byte[] palette, ushort[] colortable, _BytePtr color_prom)
        {
            int i, j, k, nextcol;
            string filename = "";

            int[] trcl1 = { 0, 0, 2, 2, 1, 1 };
            int[] trcl2 = { 1, 2, 0, 1, 0, 2 };
            int[] trcl3 = { 2, 1, 1, 0, 2, 0 };

            overlay = null;
            backdrop = null;

            /* initialize the first 8 colors with the basic colors */
            for (i = 0; i < 8; i++)
            {
                palette[3 * i] = (i & RED) != 0 ? (byte)0xff : (byte)0;
                palette[3 * i + 1] = (i & GREEN) != 0 ? (byte)0xff : (byte)0;
                palette[3 * i + 2] = (i & BLUE) != 0 ? (byte)0xff : (byte)0;
            }

            shade_fill(palette, WHITE, 8, 23, 0, 255);
            nextcol = 24;

            /* fill the rest of the 256 color entries depending on the game */
            switch (cinemat_monitor_type)
            {
                case Mame.cpu_ccpu.CCPU_MONITOR_BILEV:
                case Mame.cpu_ccpu.CCPU_MONITOR_16LEV:
                    color_display = false;
                    /* Attempt to load backdrop if requested */
                    if (cinemat_backdrop_req != 0)
                    {
                        filename = Mame.sprintf("%sb.png", Mame.Machine.gamedrv.name);
                        if ((backdrop = Mame.artwork_load(filename, nextcol, (int)(Mame.Machine.drv.total_colors - nextcol))) != null)
                        {
                            for (i = 0; i < 3 * backdrop.num_pens_used; i++)
                                palette[i + 3 * backdrop.start_pen] = backdrop.orig_palette[i];
                            nextcol += backdrop.num_pens_used;
                        }
                    }
                    /* Attempt to load overlay if requested */
                    if (cinemat_overlay_req != 0)
                    {
                        filename = Mame.sprintf("%so.png", Mame.Machine.gamedrv.name);
                        /* Attempt to load artwork from file */
                        overlay = Mame.artwork_load(filename, nextcol, (int)(Mame.Machine.drv.total_colors - nextcol));

                        if ((overlay == null) && (cinemat_simple_overlay != null))
                        {
                            /* no overlay file found - use simple artwork */
                            Mame.artwork_elements_scale(cinemat_simple_overlay,
                                                   Mame.Machine.scrbitmap.width,
                                                   Mame.Machine.scrbitmap.height);
                            overlay = Mame.artwork_create(new Mame.artwork_element[] { cinemat_simple_overlay }, nextcol,
                                                   (int)(Mame.Machine.drv.total_colors - nextcol));
                        }

                        if (overlay != null)
                            Mame.overlay_set_palette(overlay, palette, (int)(Mame.Machine.drv.total_colors - nextcol));
                    }
                    break;

                case Mame.cpu_ccpu.CCPU_MONITOR_WOWCOL:
                    color_display = true;
                    /* TODO: support real color */
                    /* put in 40 shades for red, blue and magenta */
                    shade_fill(palette, RED, 8, 47, 10, 250);
                    shade_fill(palette, BLUE, 48, 87, 10, 250);
                    shade_fill(palette, RED | BLUE, 88, 127, 10, 250);

                    /* put in 20 shades for yellow and green */
                    shade_fill(palette, GREEN, 128, 147, 10, 250);
                    shade_fill(palette, RED | GREEN, 148, 167, 10, 250);

                    /* and 14 shades for cyan and white */
                    shade_fill(palette, BLUE | GREEN, 168, 181, 10, 250);
                    shade_fill(palette, WHITE, 182, 194, 10, 250);

                    /* Fill in unused gaps with more anti-aliasing colors. */
                    /* There are 60 slots available.           .ac JAN2498 */
                    i = 195;
                    for (j = 0; j < 6; j++)
                    {
                        for (k = 7; k <= 16; k++)
                        {
                            palette[3 * i + trcl1[j]] = (byte)(((256 * k) / 16) - 1);
                            palette[3 * i + trcl2[j]] = (byte)(((128 * k) / 16) - 1);
                            palette[3 * i + trcl3[j]] = 0;
                            i++;
                        }
                    }
                    break;
            }
        }