#endif
int redraw_mask = REDRAW_NONE;
-int redraw_tiles = 0;
int FrameCounter = 0;
/* init/close functions */
/* ========================================================================= */
-void InitProgramInfo(char *argv0,
- char *userdata_subdir, char *userdata_subdir_unix,
+void InitProgramInfo(char *argv0, char *config_filename, char *userdata_subdir,
char *program_title, char *icon_title,
- char *sdl_icon_filename, char *cookie_prefix,
+ char *icon_filename, char *cookie_prefix,
int program_version)
{
program.command_basepath = getBasePath(argv0);
program.command_basename = getBaseName(argv0);
+ program.config_filename = config_filename;
+
program.userdata_subdir = userdata_subdir;
- program.userdata_subdir_unix = userdata_subdir_unix;
program.userdata_path = getUserGameDataDir();
program.program_title = program_title;
program.window_title = "(undefined)";
program.icon_title = icon_title;
- program.sdl_icon_filename = sdl_icon_filename;
+ program.icon_filename = icon_filename;
program.cookie_prefix = cookie_prefix;
program.version_build = VERSION_BUILD(program_version);
program.version_ident = program_version;
- program.error_filename = getErrorFilename(ERROR_BASENAME);
- program.error_file = stderr;
+ program.log_filename[LOG_OUT_ID] = getLogFilename(LOG_OUT_BASENAME);
+ program.log_filename[LOG_ERR_ID] = getLogFilename(LOG_ERR_BASENAME);
+ program.log_file[LOG_OUT_ID] = program.log_file_default[LOG_OUT_ID] = stdout;
+ program.log_file[LOG_ERR_ID] = program.log_file_default[LOG_ERR_ID] = stderr;
}
void SetWindowTitle()
program.exit_function = exit_function;
/* set signal handlers to custom exit function */
- signal(SIGINT, exit_function);
+ // signal(SIGINT, exit_function);
signal(SIGTERM, exit_function);
/* set exit function to automatically cleanup SDL stuff after exit() */
// this is initialized in GetOptions(), but may already be used before
options.verbose = TRUE;
-#if defined(PLATFORM_MACOSX)
- updateUserGameDataDir();
-#endif
-
- openErrorFile();
+ OpenLogFiles();
#if defined(TARGET_SDL2)
int sdl_init_flags = SDL_INIT_EVENTS | SDL_INIT_NOPARACHUTE;
void ClosePlatformDependentStuff(void)
{
-#if defined(PLATFORM_WIN32)
- closeErrorFile();
-#endif
+ CloseLogFiles();
}
void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize,
gfx.field_save_buffer = field_save_buffer;
- gfx.drawing_area_changed = FALSE;
-
SetDrawDeactivationMask(REDRAW_NONE); /* do not deactivate drawing */
SetDrawBackgroundMask(REDRAW_NONE); /* deactivate masked drawing */
}
gfx.draw_busy_anim_function = draw_busy_anim_function;
}
+void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(void))
+{
+ gfx.draw_global_anim_function = draw_global_anim_function;
+}
+
void InitGfxCustomArtworkInfo()
{
gfx.override_level_graphics = FALSE;
gfx.draw_init_text = TRUE;
}
+void InitGfxOtherSettings()
+{
+ gfx.cursor_mode = CURSOR_DEFAULT;
+}
+
void SetDrawDeactivationMask(int draw_deactivation_mask)
{
gfx.draw_deactivation_mask = draw_deactivation_mask;
}
inline static void sysFillRectangle(Bitmap *bitmap, int x, int y,
- int width, int height, Pixel color)
+ int width, int height, Pixel color)
{
SDLFillRectangle(bitmap, x, y, width, height, color);
+
+ if (bitmap == backbuffer)
+ SetRedrawMaskFromArea(x, y, width, height);
}
inline static void sysCopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
{
SDLCopyArea(src_bitmap, dst_bitmap, src_x, src_y, width, height,
dst_x, dst_y, mask_mode);
+
+ if (dst_bitmap == backbuffer)
+ SetRedrawMaskFromArea(dst_x, dst_y, width, height);
}
void LimitScreenUpdates(boolean enable)
SDLInitVideoBuffer(&backbuffer, &window, fullscreen);
+ video.initialized = TRUE;
+
drawto = backbuffer;
}
{
}
+void SetRedrawMaskFromArea(int x, int y, int width, int height)
+{
+ int x1 = x;
+ int y1 = y;
+ int x2 = x + width - 1;
+ int y2 = y + height - 1;
+
+ if (width == 0 || height == 0)
+ return;
+
+ if (IN_GFX_FIELD_FULL(x1, y1) && IN_GFX_FIELD_FULL(x2, y2))
+ redraw_mask |= REDRAW_FIELD;
+ else if (IN_GFX_DOOR_1(x1, y1) && IN_GFX_DOOR_1(x2, y2))
+ redraw_mask |= REDRAW_DOOR_1;
+ else if (IN_GFX_DOOR_2(x1, y1) && IN_GFX_DOOR_2(x2, y2))
+ redraw_mask |= REDRAW_DOOR_2;
+ else if (IN_GFX_DOOR_3(x1, y1) && IN_GFX_DOOR_3(x2, y2))
+ redraw_mask |= REDRAW_DOOR_3;
+ else
+ redraw_mask = REDRAW_ALL;
+}
+
inline static boolean CheckDrawingArea(int x, int y, int width, int height,
int draw_mask)
{
CheckDrawingArea(x, y, 1, 1, gfx.draw_background_mask));
}
-boolean DrawingAreaChanged()
-{
- int drawing_area_changed = gfx.drawing_area_changed;
-
- // reset flag for change of drawing area after querying it
- gfx.drawing_area_changed = FALSE;
-
- return drawing_area_changed;
-}
-
static boolean InClippedRectangle(Bitmap *bitmap, int *x, int *y,
int *width, int *height, boolean is_dest)
{
dst_x, dst_y);
}
+void BlitTexture(Bitmap *bitmap,
+ int src_x, int src_y, int width, int height,
+ int dst_x, int dst_y)
+{
+ if (bitmap == NULL)
+ return;
+
+ SDLBlitTexture(bitmap, src_x, src_y, width, height, dst_x, dst_y,
+ BLIT_OPAQUE);
+}
+
+void BlitTextureMasked(Bitmap *bitmap,
+ int src_x, int src_y, int width, int height,
+ int dst_x, int dst_y)
+{
+ if (bitmap == NULL)
+ return;
+
+ SDLBlitTexture(bitmap, src_x, src_y, width, height, dst_x, dst_y,
+ BLIT_MASKED);
+}
+
void DrawSimpleBlackLine(Bitmap *bitmap, int from_x, int from_y,
int to_x, int to_y)
{
#endif
}
-boolean PointerInWindow(DrawWindow *window)
-{
- return TRUE;
-}
-
boolean SetVideoMode(boolean fullscreen)
{
return SDLSetVideoMode(&backbuffer, fullscreen);
Error(ERR_EXIT, "LoadCustomImage(): cannot find file '%s'", basename);
if ((new_bitmap = LoadImage(filename)) == NULL)
- Error(ERR_EXIT, "LoadImage() failed: %s", GetError());
+ Error(ERR_EXIT, "LoadImage('%s') failed: %s", basename, GetError());
return new_bitmap;
}
if ((new_bitmap = LoadImage(filename)) == NULL)
{
- Error(ERR_WARN, "LoadImage() failed: %s", GetError());
+ Error(ERR_WARN, "LoadImage('%s') failed: %s", basename, GetError());
return;
}
CreateScaledBitmaps(bitmaps, zoom_factor, tile_size, TRUE);
}
+void CreateBitmapTextures(Bitmap **bitmaps)
+{
+ SDLCreateBitmapTextures(bitmaps[IMG_BITMAP_STANDARD]);
+}
+
void ScaleBitmap(Bitmap **bitmaps, int zoom_factor)
{
CreateScaledBitmaps(bitmaps, zoom_factor, 0, FALSE);
mode == CURSOR_PLAYFIELD ? cursor_playfield : NULL);
SDLSetMouseCursor(cursor_new);
+
+ gfx.cursor_mode = mode;
}