static int get_graphic_parameter_value(char *, char *, int);
-static Bitmap *getLoadingBackgroundBitmap(int graphic)
+static int getLoadingBackgroundImage(int graphic)
{
- return getBitmapFromGraphicOrDefault(graphic, INITIAL_IMG_BACKGROUND);
+ return getImageFromGraphicOrDefault(graphic, INITIAL_IMG_BACKGROUND);
}
static void SetLoadingWindowBackgroundImage(int graphic)
{
- SetWindowBackgroundBitmap(getLoadingBackgroundBitmap(graphic));
+ SetBackgroundImage(getLoadingBackgroundImage(graphic), REDRAW_ALL);
}
static void SetLoadingBackgroundImage(void)
}
ReCreateBitmap(&bitmap_db_field, FXSIZE, FYSIZE);
- ReCreateBitmap(&bitmap_db_panel, DXSIZE, DYSIZE);
ReCreateBitmap(&bitmap_db_door_1, 3 * DXSIZE, DYSIZE);
ReCreateBitmap(&bitmap_db_door_2, 3 * VXSIZE, VYSIZE);
gfx.draw_background_mask = draw_background_mask;
}
-static void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask)
+void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask,
+ int x, int y, int width, int height)
{
if (background_bitmap_tile != NULL)
gfx.background_bitmap_mask |= mask;
return;
if (mask == REDRAW_ALL)
- BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0,
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap,
+ x, y, width, height,
0, 0, video.width, video.height);
else if (mask == REDRAW_FIELD)
- BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0,
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap,
+ x, y, width, height,
gfx.real_sx, gfx.real_sy, gfx.full_sxsize, gfx.full_sysize);
else if (mask == REDRAW_DOOR_1)
- BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0,
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap,
+ x, y, width, height,
gfx.dx, gfx.dy, gfx.dxsize, gfx.dysize);
}
-void SetWindowBackgroundBitmap(Bitmap *background_bitmap_tile)
-{
- // remove every mask before setting mask for window
- // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!)
- SetBackgroundBitmap(NULL, 0xffff); // !!! FIX THIS !!!
- SetBackgroundBitmap(background_bitmap_tile, REDRAW_ALL);
-}
-
-void SetMainBackgroundBitmap(Bitmap *background_bitmap_tile)
-{
- // remove window area mask before setting mask for main area
- // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!)
- SetBackgroundBitmap(NULL, REDRAW_ALL); // !!! FIX THIS !!!
- SetBackgroundBitmap(background_bitmap_tile, REDRAW_FIELD);
-}
-
-void SetDoorBackgroundBitmap(Bitmap *background_bitmap_tile)
-{
- // remove window area mask before setting mask for door area
- // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!)
- SetBackgroundBitmap(NULL, REDRAW_ALL); // !!! FIX THIS !!!
- SetBackgroundBitmap(background_bitmap_tile, REDRAW_DOOR_1);
-}
-
// ============================================================================
// video functions
void SetDrawDeactivationMask(int);
int GetDrawDeactivationMask(void);
void SetDrawBackgroundMask(int);
-void SetWindowBackgroundBitmap(Bitmap *);
-void SetMainBackgroundBitmap(Bitmap *);
-void SetDoorBackgroundBitmap(Bitmap *);
+void SetBackgroundBitmap(Bitmap *, int, int, int, int, int);
void SetRedrawMaskFromArea(int, int, int, int);
void LimitScreenUpdates(boolean);
#include "config.h"
Bitmap *bitmap_db_field;
-Bitmap *bitmap_db_panel;
Bitmap *bitmap_db_door_1;
Bitmap *bitmap_db_door_2;
Bitmap *bitmap_db_store_1;
extern Bitmap *bitmap_db_field;
-extern Bitmap *bitmap_db_panel;
extern Bitmap *bitmap_db_door_1;
extern Bitmap *bitmap_db_door_2;
extern Bitmap *bitmap_db_store_1;
status);
}
-Bitmap *getBitmapFromGraphicOrDefault(int graphic, int default_graphic)
+int getImageFromGraphicOrDefault(int graphic, int default_graphic)
{
if (graphic == IMG_UNDEFINED)
- return NULL;
+ return IMG_UNDEFINED;
boolean redefined = getImageListEntryFromImageID(graphic)->redefined;
return (graphic_info[graphic].bitmap != NULL || redefined ?
- graphic_info[graphic].bitmap :
- graphic_info[default_graphic].bitmap);
+ graphic : default_graphic);
}
-static Bitmap *getBackgroundBitmap(int graphic)
+static int getBackgroundImage(int graphic)
{
- return getBitmapFromGraphicOrDefault(graphic, IMG_BACKGROUND);
+ return getImageFromGraphicOrDefault(graphic, IMG_BACKGROUND);
}
-static Bitmap *getGlobalBorderBitmap(int graphic)
+static int getGlobalBorderImage(int graphic)
{
- return getBitmapFromGraphicOrDefault(graphic, IMG_GLOBAL_BORDER);
+ return getImageFromGraphicOrDefault(graphic, IMG_GLOBAL_BORDER);
}
Bitmap *getGlobalBorderBitmapFromStatus(int status_raw)
status == GAME_MODE_EDITOR ? IMG_GLOBAL_BORDER_EDITOR :
status == GAME_MODE_PLAYING ? IMG_GLOBAL_BORDER_PLAYING :
IMG_GLOBAL_BORDER);
+ int graphic_final = getGlobalBorderImage(graphic);
- return getGlobalBorderBitmap(graphic);
+ return graphic_info[graphic_final].bitmap;
+}
+
+void SetBackgroundImage(int graphic, int redraw_mask)
+{
+ struct GraphicInfo *g = &graphic_info[graphic];
+ struct GraphicInfo g_undefined = { 0 };
+
+ if (graphic == IMG_UNDEFINED)
+ g = &g_undefined;
+
+ // remove every mask before setting mask for window, and
+ // remove window area mask before setting mask for main or door area
+ int remove_mask = (redraw_mask == REDRAW_ALL ? 0xffff : REDRAW_ALL);
+
+ // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!)
+ SetBackgroundBitmap(NULL, remove_mask, 0, 0, 0, 0); // !!! FIX THIS !!!
+ SetBackgroundBitmap(g->bitmap, redraw_mask,
+ g->src_x, g->src_y,
+ g->width, g->height);
}
void SetWindowBackgroundImageIfDefined(int graphic)
{
if (graphic_info[graphic].bitmap)
- SetWindowBackgroundBitmap(graphic_info[graphic].bitmap);
+ SetBackgroundImage(graphic, REDRAW_ALL);
}
void SetMainBackgroundImageIfDefined(int graphic)
{
if (graphic_info[graphic].bitmap)
- SetMainBackgroundBitmap(graphic_info[graphic].bitmap);
+ SetBackgroundImage(graphic, REDRAW_FIELD);
}
void SetDoorBackgroundImageIfDefined(int graphic)
{
if (graphic_info[graphic].bitmap)
- SetDoorBackgroundBitmap(graphic_info[graphic].bitmap);
+ SetBackgroundImage(graphic, REDRAW_DOOR_1);
}
void SetWindowBackgroundImage(int graphic)
{
- SetWindowBackgroundBitmap(getBackgroundBitmap(graphic));
+ SetBackgroundImage(getBackgroundImage(graphic), REDRAW_ALL);
}
void SetMainBackgroundImage(int graphic)
{
- SetMainBackgroundBitmap(getBackgroundBitmap(graphic));
+ SetBackgroundImage(getBackgroundImage(graphic), REDRAW_FIELD);
}
void SetDoorBackgroundImage(int graphic)
{
- SetDoorBackgroundBitmap(getBackgroundBitmap(graphic));
+ SetBackgroundImage(getBackgroundImage(graphic), REDRAW_DOOR_1);
}
void SetPanelBackground(void)
{
- struct GraphicInfo *gfx = &graphic_info[IMG_BACKGROUND_PANEL];
-
- BlitBitmapTiled(gfx->bitmap, bitmap_db_panel, gfx->src_x, gfx->src_y,
- gfx->width, gfx->height, 0, 0, DXSIZE, DYSIZE);
-
- SetDoorBackgroundBitmap(bitmap_db_panel);
+ SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
}
void DrawBackground(int x, int y, int width, int height)
void FadeSkipNextFadeIn(void);
void FadeSkipNextFadeOut(void);
-Bitmap *getBitmapFromGraphicOrDefault(int, int);
+int getImageFromGraphicOrDefault(int, int);
Bitmap *getGlobalBorderBitmapFromStatus(int);
void ClearField(void);
+
+void SetBackgroundImage(int, int);
void SetWindowBackgroundImageIfDefined(int);
void SetMainBackgroundImageIfDefined(int);
void SetDoorBackgroundImageIfDefined(int);