diff -r b5c2449616b5 -r 66dde6412125 src/video/sdl_v.cpp --- a/src/video/sdl_v.cpp Sun Jun 17 21:31:00 2007 +0000 +++ b/src/video/sdl_v.cpp Tue Jun 26 23:40:58 2007 +0000 @@ -37,10 +37,6 @@ static void UpdatePalette(uint start, uint count) { - /* We can only update the palette in 8bpp for now */ - /* TODO -- We need support for other bpps too! */ - if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() != 8) return; - SDL_Color pal[256]; uint i; @@ -61,9 +57,25 @@ static void CheckPaletteAnim() { - if (_pal_last_dirty != -1) { - UpdatePalette(_pal_first_dirty, _pal_last_dirty - _pal_first_dirty + 1); - _pal_last_dirty = -1; + if (_pal_count_dirty != 0) { + Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter(); + + switch (blitter->UsePaletteAnimation()) { + case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND: + UpdatePalette(_pal_first_dirty, _pal_count_dirty); + break; + + case Blitter::PALETTE_ANIMATION_BLITTER: + blitter->PaletteAnimate(_pal_first_dirty, _pal_count_dirty); + break; + + case Blitter::PALETTE_ANIMATION_NONE: + break; + + default: + NOT_REACHED(); + } + _pal_count_dirty = 0; } } @@ -430,6 +442,7 @@ static void SdlVideoMainLoop() { uint32 cur_ticks = SDL_CALL SDL_GetTicks(); + uint32 last_cur_ticks = cur_ticks; uint32 next_tick = cur_ticks + 30; uint32 pal_tick = 0; uint32 mod; @@ -460,13 +473,12 @@ cur_ticks = SDL_CALL SDL_GetTicks(); if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) { + _realtime_tick += cur_ticks - last_cur_ticks; + last_cur_ticks = cur_ticks; next_tick = cur_ticks + 30; _ctrl_pressed = !!(mod & KMOD_CTRL); _shift_pressed = !!(mod & KMOD_SHIFT); -#ifdef _DEBUG - _dbg_screen_rect = !!(mod & KMOD_CAPS); -#endif // determine which directional keys are down _dirkeys =