Пример #1
0
void SetPalRGB(int inndx,int rr,int gg,int bb) {
    if (game.color_depth > 1)
        invalidate_screen();

    wsetrgb(inndx,rr,gg,bb,palette);
    set_palette_range(palette, inndx, inndx, 0);
}
Пример #2
0
void CyclePalette(int strt,int eend) {
    // hi-color game must invalidate screen since the palette changes
    // the effect of the drawing operations
    if (game.color_depth > 1)
        invalidate_screen();

    if ((strt < 0) || (strt > 255) || (eend < 0) || (eend > 255))
        quit("!CyclePalette: start and end must be 0-255");

    if (eend > strt) {
        // forwards
        wcolrotate(strt, eend, 0, palette);
        set_palette_range(palette, strt, eend, 0);
    }
    else {
        // backwards
        wcolrotate(eend, strt, 1, palette);
        set_palette_range(palette, eend, strt, 0);
    }

}
Пример #3
0
void S9xSetPalette ()
{
    uint16 Brightness = IPPU.MaxBrightness * 138;
    PALLETE p;
    for (int i = 0; i < 256; i++)
    {
	p[i].r = (((PPU.CGDATA [i] >> 0) & 0x1F) * Brightness) >> 10;
	p[i].g = (((PPU.CGDATA [i] >> 5) & 0x1F) * Brightness) >> 10;
	p[i].b = (((PPU.CGDATA [i] >> 10) & 0x1F) * Brightness) >> 10;
    }
    set_palette_range (p, 0, 255, FALSE);
}
Пример #4
0
static void UpdatePalette(uint start, uint count)
{
	static PALETTE pal;

	uint end = start + count;
	for (uint i = start; i != end; i++) {
		pal[i].r = _cur_palette.palette[i].r / 4;
		pal[i].g = _cur_palette.palette[i].g / 4;
		pal[i].b = _cur_palette.palette[i].b / 4;
		pal[i].filler = 0;
	}

	set_palette_range(pal, start, end - 1, 1);
}
Пример #5
0
Nes_Emu::Nes_Emu()
{
	frame_ = &single_frame;
	buffer_height_ = Nes_Ppu::buffer_height + 2;
	default_sound_buf = NULL;
	sound_buf = &silent_buffer;
	sound_buf_changed_count = 0;
	equalizer_ = nes_eq;
	channel_count_ = 0;
	sound_enabled = false;
	host_pixels = NULL;
	single_frame.pixels = 0;
	single_frame.top = 0;
	init_called = false;
	set_palette_range( 0 );
	memset( single_frame.palette, 0, sizeof single_frame.palette );
}
Пример #6
0
/* do_play_fli:
 *  Worker function used by play_fli() and play_memory_fli().
 *  This is complicated by the fact that it puts the timing delay between
 *  reading a frame and displaying it, rather than between one frame and
 *  the next, in order to make the playback as smooth as possible.
 */
static int do_play_fli(BITMAP *bmp, int loop, int (*callback)(void))
{
   int ret;

   ret = next_fli_frame(loop);

   while (ret == FLI_OK) {
      /* update the palette */
      if (fli_pal_dirty_from <= fli_pal_dirty_to)
	 set_palette_range(fli_palette, fli_pal_dirty_from, fli_pal_dirty_to, TRUE);

      /* update the screen */
      if (fli_bmp_dirty_from <= fli_bmp_dirty_to) {
	 vsync();
	 blit(fli_bitmap, bmp, 0, fli_bmp_dirty_from, 0, fli_bmp_dirty_from,
			fli_bitmap->w, 1+fli_bmp_dirty_to-fli_bmp_dirty_from);
      }

      reset_fli_variables();

      if (callback) {
	 ret = (*callback)();
	 if (ret != FLI_OK)
	    break;
      }

      ret = next_fli_frame(loop);

      while (fli_timer <= 0) {
	 /* wait a bit */
	 rest(0);
      }
   }

   close_fli();

   return (ret == FLI_EOF) ? FLI_OK : ret;
}