From b003831ec2ccf7b14d2aa094466bdeb6c2f1d048 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 2 Apr 2016 10:17:39 +0200 Subject: [PATCH] fixed (reactivated) global animations (toons) for SDL 1.2 target --- src/libgame/sdl.c | 36 +++++++++++++++++++++++++++++++++--- src/libgame/sdl.h | 4 ++++ src/libgame/system.c | 2 ++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 9db8347b..a204e45f 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -575,11 +575,41 @@ static SDL_Surface *SDLCreateScreen(DrawBuffer **backbuffer, Error(ERR_WARN, "SDL_CreateWindow() failed: %s", SDL_GetError()); } -#else - new_surface = SDL_SetVideoMode(width, height, video.depth, surface_flags); +#else // TARGET_SDL - if (new_surface == NULL) + if ((*backbuffer)->surface) + { + SDL_FreeSurface((*backbuffer)->surface); + (*backbuffer)->surface = NULL; + } + + if (gfx.final_screen_bitmap == NULL) + gfx.final_screen_bitmap = CreateBitmapStruct(); + + gfx.final_screen_bitmap->width = width; + gfx.final_screen_bitmap->height = height; + + gfx.final_screen_bitmap->surface = + SDL_SetVideoMode(width, height, video.depth, surface_flags); + + if (gfx.final_screen_bitmap->surface != NULL) + { + new_surface = + SDL_CreateRGBSurface(surface_flags, width, height, video.depth, 0,0,0, 0); + + if (new_surface == NULL) + Error(ERR_WARN, "SDL_CreateRGBSurface() failed: %s", SDL_GetError()); + +#if 0 + new_surface = gfx.final_screen_bitmap->surface; + gfx.final_screen_bitmap = NULL; +#endif + + } + else + { Error(ERR_WARN, "SDL_SetVideoMode() failed: %s", SDL_GetError()); + } #endif #if defined(TARGET_SDL2) diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index 7ffb0c25..3a00cb11 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -56,7 +56,11 @@ #define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE #endif +#if defined(TARGET_SDL2) #define USE_FINAL_SCREEN_BITMAP FALSE +#else +#define USE_FINAL_SCREEN_BITMAP TRUE +#endif #define CURSOR_MAX_WIDTH 32 #define CURSOR_MAX_HEIGHT 32 diff --git a/src/libgame/system.c b/src/libgame/system.c index 26691223..8df809cd 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -208,8 +208,10 @@ void InitGfxWindowInfo(int win_xsize, int win_ysize) ReCreateBitmap(&gfx.background_bitmap, win_xsize, win_ysize, DEFAULT_DEPTH); +#if defined(TARGET_SDL2) #if USE_FINAL_SCREEN_BITMAP ReCreateBitmap(&gfx.final_screen_bitmap, win_xsize, win_ysize, DEFAULT_DEPTH); +#endif #endif ReCreateBitmap(&gfx.fade_bitmap_source, win_xsize, win_ysize, DEFAULT_DEPTH); -- 2.34.1