+2010-06-18
+ * added separately configurable game panel background to graphics config
+ * fixed displaying Supaplex time (now based on 35 fps instead of 50 fps)
+
2010-06-16
* added tape panel graphics and screen positions to graphics config
{ "background.SETUP", UNDEFINED_FILENAME },
{ "background.PLAYING", UNDEFINED_FILENAME },
{ "background.DOOR", UNDEFINED_FILENAME },
- { "background.PANEL", UNDEFINED_FILENAME },
{ "background.TAPE", "RocksDoor.pcx" },
{ "background.TAPE.x", "200" },
{ "background.TAPE.y", "280" },
{ "background.TAPE.width", "100" },
{ "background.TAPE.height", "100" },
+ { "background.PANEL", "RocksDoor.pcx" },
+ { "background.PANEL.x", "400" },
+ { "background.PANEL.y", "0" },
+ { "background.PANEL.width", "100" },
+ { "background.PANEL.height", "280" },
{ "background.titlescreen_initial_1", UNDEFINED_FILENAME },
{ "background.titlescreen_initial_2", UNDEFINED_FILENAME },
#define IMG_BACKGROUND_SETUP 1797
#define IMG_BACKGROUND_PLAYING 1798
#define IMG_BACKGROUND_DOOR 1799
-#define IMG_BACKGROUND_PANEL 1800
-#define IMG_BACKGROUND_TAPE 1801
+#define IMG_BACKGROUND_TAPE 1800
+#define IMG_BACKGROUND_PANEL 1801
#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1 1802
#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2 1803
#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3 1804
-#define COMPILE_DATE_STRING "2010-06-17 01:39"
+#define COMPILE_DATE_STRING "2010-06-19 00:55"
return;
/* copy default game door content to main double buffer */
+#if 1
+ /* !!! CHECK AGAIN !!! */
+ SetPanelBackground();
+ // SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
+ DrawBackground(DX, DY, DXSIZE, DYSIZE);
+#else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+#endif
/* redraw game control buttons */
#if 1
if (!game.restart_level)
{
/* copy default game door content to main double buffer */
+#if 1
+#if 1
+ /* !!! CHECK AGAIN !!! */
+ SetPanelBackground();
+ // SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
+ DrawBackground(DX, DY, DXSIZE, DYSIZE);
+#else
+ struct GraphicInfo *gfx = &graphic_info[IMG_BACKGROUND_PANEL];
+
+ /* (ClearRectangle() only needed if panel bitmap is smaller than panel) */
+ ClearRectangle(drawto, DX, DY, DXSIZE, DYSIZE);
+ BlitBitmap(gfx->bitmap, drawto, gfx->src_x, gfx->src_y,
+ MIN(gfx->width, DXSIZE), MIN(gfx->height, DYSIZE), DX, DY);
+#endif
+#else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+#endif
}
SetPanelBackground();
void DrawGameDoorValues_SP()
{
- game_sp.time_played = TimerVar / setup.game_frame_delay;
+#if 1
+ game_sp.time_played = TimerVar / FRAMES_PER_SECOND_SP;
+#else
+ game_sp.time_played = TimerVar * setup.game_frame_delay / 1000;
+#endif
game_sp.infotrons_still_needed = InfotronsNeeded;
game_sp.red_disk_count = RedDiskCount;
game_sp.score = 0; // (currently no score in Supaplex engine)
+
+#if 0
+ printf("::: %d, %d => %d\n",
+ TimerVar, setup.game_frame_delay, game_sp.time_played);
+#endif
}
void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode)
gfx.draw_background_mask = draw_background_mask;
}
+#if 0
+
static void DrawBitmapFromTile(Bitmap *bitmap, Bitmap *tile,
int dest_x, int dest_y, int width, int height)
{
}
}
+#else
+
+void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask)
+{
+ if (background_bitmap_tile != NULL)
+ gfx.background_bitmap_mask |= mask;
+ else
+ gfx.background_bitmap_mask &= ~mask;
+
+#if 0
+ if (gfx.background_bitmap == NULL)
+ gfx.background_bitmap = CreateBitmap(video.width, video.height,
+ DEFAULT_DEPTH);
+#endif
+
+ if (background_bitmap_tile == NULL) /* empty background requested */
+ return;
+
+ if (mask == REDRAW_ALL)
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0,
+ 0, 0, video.width, video.height);
+ else if (mask == REDRAW_FIELD)
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0,
+ 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,
+ gfx.dx, gfx.dy, gfx.dxsize, gfx.dysize);
+ }
+}
+
+#endif
+
void SetWindowBackgroundBitmap(Bitmap *background_bitmap_tile)
{
/* remove every mask before setting mask for window */
src_x, src_y, width, height, dst_x, dst_y, BLIT_OPAQUE);
}
+void BlitBitmapTiled(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+ int src_x, int src_y, int src_width, int src_height,
+ int dst_x, int dst_y, int dst_width, int dst_height)
+{
+ int src_xsize = (src_width == 0 ? src_bitmap->width : src_width);
+ int src_ysize = (src_height == 0 ? src_bitmap->height : src_height);
+ int dst_xsize = dst_width;
+ int dst_ysize = dst_height;
+ int src_xsteps = (dst_xsize + src_xsize - 1) / src_xsize;
+ int src_ysteps = (dst_ysize + src_ysize - 1) / src_ysize;
+ int x, y;
+
+ for (y = 0; y < src_ysteps; y++)
+ {
+ for (x = 0; x < src_xsteps; x++)
+ {
+ int draw_x = dst_x + x * src_xsize;
+ int draw_y = dst_y + y * src_ysize;
+ int draw_xsize = MIN(src_xsize, dst_xsize - x * src_xsize);
+ int draw_ysize = MIN(src_ysize, dst_ysize - y * src_ysize);
+
+ BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, draw_xsize, draw_ysize,
+ draw_x, draw_y);
+ }
+ }
+}
+
void FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
int fade_mode, int fade_delay, int post_delay,
void (*draw_border_function)(void))
#define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */
#define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */
#define FRAMES_PER_SECOND (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
+#define FRAMES_PER_SECOND_SP 35
/* maximum playfield size supported by libgame functions */
#define MAX_PLAYFIELD_WIDTH 128
void ReCreateBitmap(Bitmap **, int, int, int);
void FreeBitmap(Bitmap *);
void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
+void BlitBitmapTiled(Bitmap *, Bitmap *, int, int, int, int, int, int, int,int);
void FadeRectangle(Bitmap *bitmap, int, int, int, int, int, int, int,
void (*draw_border_function)(void));
void FillRectangle(Bitmap *, int, int, int, int, Pixel);
video_pos[i][j].pos->y < 0)
continue;
-#if 0
- printf("::: %d: %d, %ld\n",
- i,
- video_pos[i][j].graphic,
- graphic_info[video_pos[i][j].graphic].bitmap);
-#endif
-
-#if 0
- if (i < 9)
- continue;
-#endif
-
if (state & (1 << (i * 2 + k)))
{
struct GraphicInfo *gfx_bg = &graphic_info[IMG_BACKGROUND_TAPE];
gd_y = gfx_bg->src_y + pos->y;
}
-#if 0
- printf("::: %d (%d): %d, %ld - %d [%d] [%d] [%d]\n",
- i, k,
- video_pos[i][j].graphic,
- graphic_info[video_pos[i][j].graphic].bitmap,
- gfx->bitmap,
- gd_bitmap,
- (gd_bitmap == NULL),
- 0);
-
- if (gd_bitmap == NULL)
- printf("::: gfx %d skipped\n", video_pos[i][j].graphic);
-#endif
-
/* some tape graphics may be undefined -- only draw if defined */
if (gd_bitmap != NULL)
BlitBitmap(gd_bitmap, drawto, gd_x, gd_y, gfx->width, gfx->height,
void SetPanelBackground()
{
+#if 1
+ struct GraphicInfo *gfx = &graphic_info[IMG_BACKGROUND_PANEL];
+
+#if 1
+ BlitBitmapTiled(gfx->bitmap, bitmap_db_panel, gfx->src_x, gfx->src_y,
+ gfx->width, gfx->height, 0, 0, DXSIZE, DYSIZE);
+#else
+ /* (ClearRectangle() only needed if panel bitmap is smaller than panel) */
+ ClearRectangle(bitmap_db_panel, DX, DY, DXSIZE, DYSIZE);
+ BlitBitmap(gfx->bitmap, bitmap_db_panel, gfx->src_x, gfx->src_y,
+ MIN(gfx->width, DXSIZE), MIN(gfx->height, DYSIZE), 0, 0);
+#endif
+#else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, bitmap_db_panel,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, 0, 0);
+#endif
SetDoorBackgroundBitmap(bitmap_db_panel);
}