X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=0e221548949504e1a3f65254638f08432cdd70aa;hb=b201bc433fb5ad1a9f0b7780ac6a73a3617f6dd6;hp=f5125c611a14e5f21b600873ddef0cec3024bd0e;hpb=fe158e864d3fa4b0221e9c88d8dfff0157051396;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index f5125c61..0e221548 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -40,8 +40,8 @@ struct ArtworkInfo artwork; struct JoystickInfo joystick; struct SetupInfo setup; -struct LevelDirInfo *leveldir_first = NULL; -struct LevelDirInfo *leveldir_current = NULL; +LevelDirTree *leveldir_first = NULL; +LevelDirTree *leveldir_current = NULL; int level_nr; Display *display = NULL; @@ -157,6 +157,8 @@ void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize, gfx.real_sy = real_sy; gfx.full_sxsize = full_sxsize; gfx.full_sysize = full_sysize; + + SetDrawDeactivationMask(REDRAW_NONE); /* do not deactivate drawing */ } void InitGfxDoor1Info(int dx, int dy, int dxsize, int dysize) @@ -182,6 +184,11 @@ void InitGfxScrollbufferInfo(int scrollbuffer_width, int scrollbuffer_height) gfx.scrollbuffer_height = scrollbuffer_height; } +void SetDrawDeactivationMask(int draw_deactivation_mask) +{ + gfx.draw_deactivation_mask = draw_deactivation_mask; +} + /* ========================================================================= */ /* video functions */ @@ -208,6 +215,7 @@ inline void CloseVideoDisplay(void) #if defined(TARGET_SDL) SDL_QuitSubSystem(SDL_INIT_VIDEO); #else + if (display) XCloseDisplay(display); #endif @@ -318,11 +326,26 @@ inline void CloseWindow(DrawWindow *window) #endif } +inline boolean DrawingDeactivated(int x, int y, int width, int height) +{ + if (gfx.draw_deactivation_mask != REDRAW_NONE) + { + if ((gfx.draw_deactivation_mask & REDRAW_FIELD) && + x < gfx.sx + gfx.sxsize) + return TRUE; + } + + return FALSE; +} + inline void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, int src_x, int src_y, int width, int height, int dst_x, int dst_y) { + if (DrawingDeactivated(dst_x, dst_y, width, height)) + return; + #ifdef TARGET_SDL SDLCopyArea(src_bitmap, dst_bitmap, src_x, src_y, width, height, dst_x, dst_y, SDLCOPYAREA_OPAQUE); @@ -334,6 +357,9 @@ inline void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, inline void ClearRectangle(Bitmap *bitmap, int x, int y, int width, int height) { + if (DrawingDeactivated(x, y, width, height)) + return; + #ifdef TARGET_SDL SDLFillRectangle(bitmap, x, y, width, height, 0x000000); #else @@ -380,6 +406,9 @@ inline void BlitBitmapMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap, int width, int height, int dst_x, int dst_y) { + if (DrawingDeactivated(dst_x, dst_y, width, height)) + return; + #ifdef TARGET_SDL SDLCopyArea(src_bitmap, dst_bitmap, src_x, src_y, width, height, dst_x, dst_y, SDLCOPYAREA_MASKED); @@ -611,13 +640,16 @@ Bitmap *LoadImage(char *filename) Bitmap *LoadCustomImage(char *basename) { - char *filename = getStringCopy(getCustomImageFilename(basename)); + char *filename = getCustomImageFilename(basename); Bitmap *new_bitmap; + if (filename == NULL) + Error(ERR_EXIT, "LoadCustomImage(): cannot find file '%s'", basename); + if ((new_bitmap = LoadImage(filename)) == NULL) Error(ERR_EXIT, "LoadImage() failed: %s", GetError()); - new_bitmap->source_filename = filename; + new_bitmap->source_filename = getStringCopy(filename); return new_bitmap; }