From: Holger Schemel Date: Fri, 18 Jun 2010 23:06:23 +0000 (+0200) Subject: rnd-20100619-1-src X-Git-Tag: 3.3.1.0^2~24 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=cd77f8c1eb3e792f1cd0c108ce49a03d762ebb96;p=rocksndiamonds.git rnd-20100619-1-src * added separately configurable game panel background to graphics config * fixed displaying Supaplex time (now based on 35 fps instead of 50 fps) --- diff --git a/ChangeLog b/ChangeLog index 1c841f25..6acb9f33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +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 diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 45987920..457cdf59 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5186,12 +5186,16 @@ struct ConfigInfo image_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 }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 9549f18e..9340cc2b 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1818,8 +1818,8 @@ #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 diff --git a/src/conftime.h b/src/conftime.h index 21a2f126..c2d1ae25 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-06-17 01:39" +#define COMPILE_DATE_STRING "2010-06-19 00:55" diff --git a/src/game.c b/src/game.c index cb3434a1..5b28f29b 100644 --- a/src/game.c +++ b/src/game.c @@ -2539,8 +2539,15 @@ void DisplayGameControlValues() 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 @@ -4539,8 +4546,24 @@ void InitGame() 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(); diff --git a/src/game_sp/main.c b/src/game_sp/main.c index a1fbe44a..818d4e36 100644 --- a/src/game_sp/main.c +++ b/src/game_sp/main.c @@ -66,10 +66,19 @@ void RedrawPlayfield_SP(boolean force_redraw) 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) diff --git a/src/libgame/system.c b/src/libgame/system.c index 4b7a3cad..c2e9a300 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -244,6 +244,8 @@ void SetDrawBackgroundMask(int draw_background_mask) 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) { @@ -300,6 +302,39 @@ void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) } } +#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 */ @@ -705,6 +740,33 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, 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)) diff --git a/src/libgame/system.h b/src/libgame/system.h index 176085d4..06ad220d 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -304,6 +304,7 @@ #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 @@ -1222,6 +1223,7 @@ Bitmap *CreateBitmap(int, int, int); 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); diff --git a/src/tape.c b/src/tape.c index bc258b66..cf72eda3 100644 --- a/src/tape.c +++ b/src/tape.c @@ -409,18 +409,6 @@ void DrawVideoDisplay(unsigned long state, unsigned long value) 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]; @@ -447,20 +435,6 @@ void DrawVideoDisplay(unsigned long state, unsigned long value) 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, diff --git a/src/tools.c b/src/tools.c index a5a3850e..bc9e6df3 100644 --- a/src/tools.c +++ b/src/tools.c @@ -795,8 +795,22 @@ void SetDoorBackgroundImage(int graphic) 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); }