X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=497f7e0b26741e90efd50e7b90996960a0804757;hb=4a137589031aa2c7effd6b020170098a976c566b;hp=a91d243876c6800365a2f039af56257f9ed7d1ee;hpb=e0e2697df0d0da483a91b1248c120aef6b3caf9b;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index a91d2438..497f7e0b 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -36,6 +36,7 @@ struct OptionInfo options; struct VideoSystemInfo video; struct AudioSystemInfo audio; struct GfxInfo gfx; +struct ArtworkInfo artwork; struct JoystickInfo joystick; struct SetupInfo setup; @@ -113,7 +114,8 @@ void InitProgramInfo(char *unix_userdata_directory, char *program_title, char *window_title, char *icon_title, char *x11_icon_basename, char *x11_iconmask_basename, char *msdos_pointer_basename, - char *cookie_prefix, int program_version) + char *cookie_prefix, char *filename_prefix, + int program_version) { char *x11_icon_filename = getPath2(options.graphics_directory, x11_icon_basename); @@ -134,7 +136,10 @@ void InitProgramInfo(char *unix_userdata_directory, char *program_title, program.x11_icon_filename = x11_icon_filename; program.x11_iconmask_filename = x11_iconmask_filename; program.msdos_pointer_filename = msdos_pointer_filename; + program.cookie_prefix = cookie_prefix; + program.filename_prefix = filename_prefix; + program.version_major = VERSION_MAJOR(program_version); program.version_minor = VERSION_MINOR(program_version); program.version_patch = VERSION_PATCH(program_version); @@ -152,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) @@ -177,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 */ @@ -294,6 +306,9 @@ inline void FreeBitmap(Bitmap *bitmap) XFreeGC(display, bitmap->stored_clip_gc); #endif + if (bitmap->source_filename) + free(bitmap->source_filename); + free(bitmap); } @@ -310,11 +325,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); @@ -326,6 +356,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 @@ -372,6 +405,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); @@ -588,10 +624,9 @@ inline boolean ChangeVideoModeIfNeeded(boolean fullscreen) return fullscreen; } -Bitmap *LoadImage(char *basename) +Bitmap *LoadImage(char *filename) { Bitmap *new_bitmap; - char *filename = getPath2(options.graphics_directory, basename); #if defined(TARGET_SDL) new_bitmap = SDLLoadImage(filename); @@ -599,7 +634,18 @@ Bitmap *LoadImage(char *basename) new_bitmap = X11LoadImage(filename); #endif - free(filename); + return new_bitmap; +} + +Bitmap *LoadCustomImage(char *basename) +{ + char *filename = getStringCopy(getCustomImageFilename(basename)); + Bitmap *new_bitmap; + + if ((new_bitmap = LoadImage(filename)) == NULL) + Error(ERR_EXIT, "LoadImage() failed: %s", GetError()); + + new_bitmap->source_filename = filename; return new_bitmap; }