X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsdl.c;h=71d9fbbe7274d71555b4c7ef90552b78a8e78124;hb=2845fcd0832f6b527e582c77354e82d433e4459b;hp=baa53340c4502380357bc45e8540f1efe11eb782;hpb=a30a27ce6c313e56cc92dc7183d599f63f8ca1f2;p=rocksndiamonds.git diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index baa53340..71d9fbbe 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -65,10 +65,17 @@ static void FinalizeScreen(int draw_target) // copy tile selection cursor to render target buffer, if defined (above all) if (gfx.draw_tile_cursor_function != NULL) gfx.draw_tile_cursor_function(draw_target); + + // copy global animations to render target buffer, if defined (mouse pointer) + if (gfx.draw_global_anim_function != NULL) + gfx.draw_global_anim_function(draw_target, DRAW_GLOBAL_ANIM_STAGE_3); } static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay) { + if (program.headless) + return; + static DelayCounter update_screen_delay = { 50 }; // (milliseconds) SDL_Surface *screen = backbuffer->surface; @@ -1451,14 +1458,14 @@ static void _PutPixel(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) case 1: { // Assuming 8-bpp - *((Uint8 *)surface->pixels + y*surface->pitch + x) = color; + *((Uint8 *)surface->pixels + y * surface->pitch + x) = color; } break; case 2: { // Probably 15-bpp or 16-bpp - *((Uint16 *)surface->pixels + y*surface->pitch/2 + x) = color; + *((Uint16 *)surface->pixels + y * surface->pitch / 2 + x) = color; } break; @@ -1469,20 +1476,20 @@ static void _PutPixel(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) int shift; // Gack - slow, but endian correct - pix = (Uint8 *)surface->pixels + y * surface->pitch + x*3; + pix = (Uint8 *)surface->pixels + y * surface->pitch + x * 3; shift = surface->format->Rshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; shift = surface->format->Gshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; shift = surface->format->Bshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; } break; case 4: { // Probably 32-bpp - *((Uint32 *)surface->pixels + y*surface->pitch/4 + x) = color; + *((Uint32 *)surface->pixels + y * surface->pitch / 4 + x) = color; } break; } @@ -1498,12 +1505,12 @@ static void _PutPixelRGB(SDL_Surface *surface, Sint16 x, Sint16 y, static void _PutPixel8(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) { - *((Uint8 *)surface->pixels + y*surface->pitch + x) = color; + *((Uint8 *)surface->pixels + y * surface->pitch + x) = color; } static void _PutPixel16(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) { - *((Uint16 *)surface->pixels + y*surface->pitch/2 + x) = color; + *((Uint16 *)surface->pixels + y * surface->pitch / 2 + x) = color; } static void _PutPixel24(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) @@ -1512,38 +1519,38 @@ static void _PutPixel24(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) int shift; // Gack - slow, but endian correct - pix = (Uint8 *)surface->pixels + y * surface->pitch + x*3; + pix = (Uint8 *)surface->pixels + y * surface->pitch + x * 3; shift = surface->format->Rshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; shift = surface->format->Gshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; shift = surface->format->Bshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; } static void _PutPixel32(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) { - *((Uint32 *)surface->pixels + y*surface->pitch/4 + x) = color; + *((Uint32 *)surface->pixels + y * surface->pitch / 4 + x) = color; } -static void _PutPixelX(SDL_Surface *dest,Sint16 x,Sint16 y,Uint32 color) +static void _PutPixelX(SDL_Surface *dest, Sint16 x, Sint16 y, Uint32 color) { switch (dest->format->BytesPerPixel) { case 1: - *((Uint8 *)dest->pixels + y*dest->pitch + x) = color; + *((Uint8 *)dest->pixels + y * dest->pitch + x) = color; break; case 2: - *((Uint16 *)dest->pixels + y*dest->pitch/2 + x) = color; + *((Uint16 *)dest->pixels + y * dest->pitch / 2 + x) = color; break; case 3: - _PutPixel24(dest,x,y,color); + _PutPixel24(dest, x, y, color); break; case 4: - *((Uint32 *)dest->pixels + y*dest->pitch/4 + x) = color; + *((Uint32 *)dest->pixels + y * dest->pitch / 4 + x) = color; break; } } @@ -1581,19 +1588,19 @@ static Sint32 sge_CalcYPitch(SDL_Surface *dest, Sint16 y) switch (dest->format->BytesPerPixel) { case 1: - return y*dest->pitch; + return y * dest->pitch; break; case 2: - return y*dest->pitch/2; + return y * dest->pitch / 2; break; case 3: - return y*dest->pitch; + return y * dest->pitch; break; case 4: - return y*dest->pitch/4; + return y * dest->pitch / 4; break; } } @@ -1629,13 +1636,13 @@ static void sge_pPutPixel(SDL_Surface *surface, Sint16 x, Sint32 ypitch, int shift; // Gack - slow, but endian correct - pix = (Uint8 *)surface->pixels + ypitch + x*3; + pix = (Uint8 *)surface->pixels + ypitch + x * 3; shift = surface->format->Rshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; shift = surface->format->Gshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; shift = surface->format->Bshift; - *(pix+shift/8) = color>>shift; + *(pix + shift / 8) = color>>shift; } break;