From: Holger Schemel Date: Fri, 13 Oct 2006 01:15:22 +0000 (+0200) Subject: rnd-20061013-1-src X-Git-Tag: 3.2.3^2~36 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8b04d496646e102dd15710ba091e2f37cadcec5e;p=rocksndiamonds.git rnd-20061013-1-src * added directives "border.draw_masked.*" for menu/playfield area and door areas to display overlapping/masked borders from "global.border" --- diff --git a/ChangeLog b/ChangeLog index 16e53b91..31f250cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-10-12 + * added directives "border.draw_masked.*" for menu/playfield area and + door areas to display overlapping/masked borders from "global.border" + 2006-10-09 * fixed bug with CE with move speed "not moving" not being animated * when changing player artwork by CE action, reset animation frame diff --git a/src/conf_gfx.c b/src/conf_gfx.c index b67f1f53..56c3c61b 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -4513,6 +4513,16 @@ struct ConfigInfo image_config[] = { "global.num_toons", "20" }, + { "border.draw_masked.TITLE", "false" }, + { "border.draw_masked.MAIN", "false" }, + { "border.draw_masked.LEVELS", "false" }, + { "border.draw_masked.SCORES", "false" }, + { "border.draw_masked.EDITOR", "false" }, + { "border.draw_masked.INFO", "false" }, + { "border.draw_masked.SETUP", "false" }, + { "border.draw_masked.PLAYING", "false" }, + { "border.draw_masked.DOOR", "false" }, + { "menu.draw_xoffset", "0" }, { "menu.draw_yoffset", "0" }, { "menu.draw_xoffset.MAIN", "0" }, diff --git a/src/conftime.h b/src/conftime.h index b9d640b7..795a7679 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-10-09 21:55]" +#define COMPILE_DATE_STRING "[2006-10-13 03:06]" diff --git a/src/game.c b/src/game.c index 4d71c89a..e868babe 100644 --- a/src/game.c +++ b/src/game.c @@ -2927,10 +2927,9 @@ int NewHiScore() return position; } -inline static int getElementMoveStepsize(int x, int y) +inline static int getElementMoveStepsizeExt(int x, int y, int direction) { int element = Feld[x][y]; - int direction = MovDir[x][y]; int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0); int dy = (direction == MV_UP ? -1 : direction == MV_DOWN ? +1 : 0); int horiz_move = (dx != 0); @@ -2950,6 +2949,11 @@ inline static int getElementMoveStepsize(int x, int y) return step; } +inline static int getElementMoveStepsize(int x, int y) +{ + return getElementMoveStepsizeExt(x, y, MovDir[x][y]); +} + void InitPlayerGfxAnimation(struct PlayerInfo *player, int action, int dir) { if (player->GfxAction != action || player->GfxDir != dir) @@ -3006,19 +3010,35 @@ static void ResetRandomAnimationValue(int x, int y) void InitMovingField(int x, int y, int direction) { int element = Feld[x][y]; - int move_stepsize = getElementMoveStepsize(x, y); int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0); int dy = (direction == MV_UP ? -1 : direction == MV_DOWN ? +1 : 0); int newx = x + dx; int newy = y + dy; - boolean is_moving = (move_stepsize != 0); /* moving or being moved */ + boolean is_moving_before, is_moving_after; +#if 0 boolean continues_moving = (WasJustMoving[x][y] && direction == MovDir[x][y]); +#endif - /* reset animation only for moving elements that change direction of moving + /* check if element was/is moving or being moved before/after mode change */ +#if 1 + is_moving_before = WasJustMoving[x][y]; +#else + is_moving_before = (getElementMoveStepsizeExt(x, y, MovDir[x][y]) != 0); +#endif + is_moving_after = (getElementMoveStepsizeExt(x, y, direction) != 0); + + /* reset animation only for moving elements which change direction of moving + or which just started or stopped moving (else CEs with property "can move" / "not moving" are reset each frame) */ #if USE_GFX_RESET_ONLY_WHEN_MOVING - if (is_moving && !continues_moving) +#if 1 + if (is_moving_before != is_moving_after || + direction != MovDir[x][y]) ResetGfxAnimation(x, y); +#else + if ((is_moving_before || is_moving_after) && !continues_moving) + ResetGfxAnimation(x, y); +#endif #else if (!continues_moving) ResetGfxAnimation(x, y); @@ -3026,13 +3046,19 @@ void InitMovingField(int x, int y, int direction) MovDir[x][y] = direction; GfxDir[x][y] = direction; - GfxAction[x][y] = (!is_moving ? ACTION_WAITING : + +#if USE_GFX_RESET_ONLY_WHEN_MOVING + GfxAction[x][y] = (!is_moving_after ? ACTION_WAITING : direction == MV_DOWN && CAN_FALL(element) ? ACTION_FALLING : ACTION_MOVING); +#else + GfxAction[x][y] = (direction == MV_DOWN && CAN_FALL(element) ? + ACTION_FALLING : ACTION_MOVING); +#endif /* this is needed for CEs with property "can move" / "not moving" */ - if (is_moving) + if (is_moving_after) { if (Feld[newx][newy] == EL_EMPTY) Feld[newx][newy] = EL_BLOCKED; diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index d06cca94..6ac1229f 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -35,12 +35,12 @@ static int fullscreen_yoffset; static int video_xoffset; static int video_yoffset; -static void setFullscreenParameters() +static void setFullscreenParameters(char *fullscreen_mode_string) { struct ScreenModeInfo *fullscreen_mode; int i; - fullscreen_mode = get_screen_mode_from_string(setup.fullscreen_mode); + fullscreen_mode = get_screen_mode_from_string(fullscreen_mode_string); if (fullscreen_mode == NULL) return; @@ -240,7 +240,7 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen) if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available) { - setFullscreenParameters(); + setFullscreenParameters(setup.fullscreen_mode); video_xoffset = fullscreen_xoffset; video_yoffset = fullscreen_yoffset; @@ -255,6 +255,7 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen) /* do not try it again */ video.fullscreen_available = FALSE; + success = FALSE; } else @@ -262,6 +263,8 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen) (*backbuffer)->surface = new_surface; video.fullscreen_enabled = TRUE; + video.fullscreen_mode_current = setup.fullscreen_mode; + success = TRUE; } } @@ -383,7 +386,8 @@ void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y, int width, int height, } void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, - int fade_mode, int fade_delay, int post_delay) + int fade_mode, int fade_delay, int post_delay, + void (*draw_border_function)(void)) { static boolean initialization_needed = TRUE; static SDL_Surface *surface_source = NULL; @@ -497,6 +501,9 @@ void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, SDL_SetAlpha(surface_target, SDL_SRCALPHA, alpha_final); SDL_BlitSurface(surface_target, &src_rect, surface_screen, &dst_rect); + if (draw_border_function != NULL) + draw_border_function(); + #if 1 /* only update the region of the screen that is affected from fading */ SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height); diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index 625b89e6..5ab0461d 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -354,7 +354,8 @@ void SDLCreateBitmapContent(Bitmap *, int, int, int); void SDLFreeBitmapPointers(Bitmap *); void SDLCopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int); void SDLFillRectangle(Bitmap *, int, int, int, int, Uint32); -void SDLFadeRectangle(Bitmap *, int, int, int, int, int, int, int); +void SDLFadeRectangle(Bitmap *, int, int, int, int, int, int, int, + void (*draw_border_function)(void)); void SDLDrawSimpleLine(Bitmap *, int, int, int, int, Uint32); void SDLDrawLine(Bitmap *, int, int, int, int, Uint32); Pixel SDLGetPixel(Bitmap *, int, int); diff --git a/src/libgame/system.c b/src/libgame/system.c index 6e3eaaba..55046b88 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -462,14 +462,15 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, } void FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, - int fade_mode, int fade_delay, int post_delay) + int fade_mode, int fade_delay, int post_delay, + void (*draw_border_function)(void)) { #if defined(TARGET_SDL) SDLFadeRectangle(bitmap_cross, x, y, width, height, - fade_mode, fade_delay, post_delay); + fade_mode, fade_delay, post_delay, draw_border_function); #else X11FadeRectangle(bitmap_cross, x, y, width, height, - fade_mode, fade_delay, post_delay); + fade_mode, fade_delay, post_delay, draw_border_function); #endif } diff --git a/src/libgame/system.h b/src/libgame/system.h index 99d7c59d..081471ab 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1047,7 +1047,8 @@ Bitmap *CreateBitmapStruct(void); Bitmap *CreateBitmap(int, int, int); void FreeBitmap(Bitmap *); void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int); -void FadeRectangle(Bitmap *bitmap, 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); void ClearRectangle(Bitmap *, int, int, int, int); void ClearRectangleOnBackground(Bitmap *, int, int, int, int); diff --git a/src/libgame/toons.c b/src/libgame/toons.c index c5f1ff39..f48621b9 100644 --- a/src/libgame/toons.c +++ b/src/libgame/toons.c @@ -335,15 +335,20 @@ void HandleAnimation(int mode) break; case ANIM_STOP: - redraw_mask |= (REDRAW_FIELD | REDRAW_FROM_BACKBUFFER); + if (anim_running) + { +#if 0 + redraw_mask |= (REDRAW_FIELD | REDRAW_FROM_BACKBUFFER); - /* Redraw background even when in direct drawing mode */ - draw_mode = setup.direct_draw; - setup.direct_draw = FALSE; - screen_info.update_function(); - setup.direct_draw = draw_mode; + /* Redraw background even when in direct drawing mode */ + draw_mode = setup.direct_draw; + setup.direct_draw = FALSE; + screen_info.update_function(); + setup.direct_draw = draw_mode; +#endif - anim_running = FALSE; + anim_running = FALSE; + } return; diff --git a/src/libgame/x11.c b/src/libgame/x11.c index a9f23431..2bbf76d5 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -363,14 +363,18 @@ void X11FillRectangle(Bitmap *bitmap, int x, int y, } void X11FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, - int fade_mode, int fade_delay, int post_delay) + int fade_mode, int fade_delay, int post_delay, + void (*draw_border_function)(void)) { /* fading currently not supported -- simply copy backbuffer to screen */ if (fade_mode == FADE_MODE_FADE_OUT) - X11FillRectangle(window, x, y, width, height, BLACK_PIXEL); - else - X11CopyArea(backbuffer, window, x, y, width, height, 0, 0, BLIT_OPAQUE); + X11FillRectangle(backbuffer, x, y, width, height, BLACK_PIXEL); + + if (draw_border_function != NULL) + draw_border_function(); + + X11CopyArea(backbuffer, window, x, y, width, height, 0, 0, BLIT_OPAQUE); /* as we currently cannot use the fade delay, also do not use post delay */ } diff --git a/src/libgame/x11.h b/src/libgame/x11.h index 0e2ba46e..28e8f5e8 100644 --- a/src/libgame/x11.h +++ b/src/libgame/x11.h @@ -339,7 +339,8 @@ void X11CreateBitmapContent(Bitmap *, int, int, int); void X11FreeBitmapPointers(Bitmap *); void X11CopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int); void X11FillRectangle(Bitmap *, int, int, int, int, Pixel); -void X11FadeRectangle(Bitmap *, int, int, int, int, int, int, int); +void X11FadeRectangle(Bitmap *, int, int, int, int, int, int, int, + void (*draw_border_function)(void)); void X11DrawSimpleLine(Bitmap *, int, int, int, int, Pixel); Pixel X11GetPixel(Bitmap *, int, int); Pixel X11GetPixelFromRGB(unsigned int, unsigned int, unsigned int); diff --git a/src/main.c b/src/main.c index 25bdd22b..76799920 100644 --- a/src/main.c +++ b/src/main.c @@ -104,6 +104,7 @@ struct TapeInfo tape; struct SetupInfo setup; struct GameInfo game; struct GlobalInfo global; +struct BorderInfo border; struct MenuInfo menu; struct DoorInfo door_1, door_2; struct PreviewInfo preview; @@ -4636,71 +4637,81 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] = struct TokenIntPtrInfo image_config_vars[] = { - { "global.num_toons", &global.num_toons }, + { "global.num_toons", &global.num_toons }, - { "menu.draw_xoffset", &menu.draw_xoffset[GFX_SPECIAL_ARG_DEFAULT] }, - { "menu.draw_yoffset", &menu.draw_yoffset[GFX_SPECIAL_ARG_DEFAULT] }, - { "menu.draw_xoffset.MAIN", &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN] }, - { "menu.draw_yoffset.MAIN", &menu.draw_yoffset[GFX_SPECIAL_ARG_MAIN] }, - { "menu.draw_xoffset.LEVELS", &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELS] }, - { "menu.draw_yoffset.LEVELS", &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS] }, - { "menu.draw_xoffset.SCORES", &menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES] }, - { "menu.draw_yoffset.SCORES", &menu.draw_yoffset[GFX_SPECIAL_ARG_SCORES] }, - { "menu.draw_xoffset.EDITOR", &menu.draw_xoffset[GFX_SPECIAL_ARG_EDITOR] }, - { "menu.draw_yoffset.EDITOR", &menu.draw_yoffset[GFX_SPECIAL_ARG_EDITOR] }, - { "menu.draw_xoffset.INFO", &menu.draw_xoffset[GFX_SPECIAL_ARG_INFO] }, - { "menu.draw_yoffset.INFO", &menu.draw_yoffset[GFX_SPECIAL_ARG_INFO] }, - { "menu.draw_xoffset.SETUP", &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP] }, - { "menu.draw_yoffset.SETUP", &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP] }, + { "border.draw_masked.TITLE", &border.draw_masked[GFX_SPECIAL_ARG_TITLE] }, + { "border.draw_masked.MAIN", &border.draw_masked[GFX_SPECIAL_ARG_MAIN] }, + { "border.draw_masked.LEVELS", &border.draw_masked[GFX_SPECIAL_ARG_LEVELS] }, + { "border.draw_masked.SCORES", &border.draw_masked[GFX_SPECIAL_ARG_SCORES] }, + { "border.draw_masked.EDITOR", &border.draw_masked[GFX_SPECIAL_ARG_EDITOR] }, + { "border.draw_masked.INFO", &border.draw_masked[GFX_SPECIAL_ARG_INFO] }, + { "border.draw_masked.SETUP", &border.draw_masked[GFX_SPECIAL_ARG_SETUP] }, + { "border.draw_masked.PLAYING",&border.draw_masked[GFX_SPECIAL_ARG_PLAYING] }, + { "border.draw_masked.DOOR", &border.draw_masked[GFX_SPECIAL_ARG_DOOR] }, - { "menu.scrollbar_xoffset", &menu.scrollbar_xoffset }, + { "menu.draw_xoffset", &menu.draw_xoffset[GFX_SPECIAL_ARG_DEFAULT] }, + { "menu.draw_yoffset", &menu.draw_yoffset[GFX_SPECIAL_ARG_DEFAULT] }, + { "menu.draw_xoffset.MAIN", &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN] }, + { "menu.draw_yoffset.MAIN", &menu.draw_yoffset[GFX_SPECIAL_ARG_MAIN] }, + { "menu.draw_xoffset.LEVELS", &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELS] }, + { "menu.draw_yoffset.LEVELS", &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS] }, + { "menu.draw_xoffset.SCORES", &menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES] }, + { "menu.draw_yoffset.SCORES", &menu.draw_yoffset[GFX_SPECIAL_ARG_SCORES] }, + { "menu.draw_xoffset.EDITOR", &menu.draw_xoffset[GFX_SPECIAL_ARG_EDITOR] }, + { "menu.draw_yoffset.EDITOR", &menu.draw_yoffset[GFX_SPECIAL_ARG_EDITOR] }, + { "menu.draw_xoffset.INFO", &menu.draw_xoffset[GFX_SPECIAL_ARG_INFO] }, + { "menu.draw_yoffset.INFO", &menu.draw_yoffset[GFX_SPECIAL_ARG_INFO] }, + { "menu.draw_xoffset.SETUP", &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP] }, + { "menu.draw_yoffset.SETUP", &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP] }, - { "menu.list_size", &menu.list_size[GFX_SPECIAL_ARG_DEFAULT] }, - { "menu.list_size.LEVELS", &menu.list_size[GFX_SPECIAL_ARG_LEVELS] }, - { "menu.list_size.SCORES", &menu.list_size[GFX_SPECIAL_ARG_SCORES] }, - { "menu.list_size.INFO", &menu.list_size[GFX_SPECIAL_ARG_INFO] }, + { "menu.scrollbar_xoffset", &menu.scrollbar_xoffset }, - { "menu.fade_delay", &menu.fade_delay }, - { "menu.post_delay", &menu.post_delay }, + { "menu.list_size", &menu.list_size[GFX_SPECIAL_ARG_DEFAULT] }, + { "menu.list_size.LEVELS", &menu.list_size[GFX_SPECIAL_ARG_LEVELS] }, + { "menu.list_size.SCORES", &menu.list_size[GFX_SPECIAL_ARG_SCORES] }, + { "menu.list_size.INFO", &menu.list_size[GFX_SPECIAL_ARG_INFO] }, - { "door_1.width", &door_1.width }, - { "door_1.height", &door_1.height }, - { "door_1.step_offset", &door_1.step_offset }, - { "door_1.step_delay", &door_1.step_delay }, - { "door_1.anim_mode", &door_1.anim_mode }, - { "door_2.width", &door_2.width }, - { "door_2.height", &door_2.height }, - { "door_2.step_offset", &door_2.step_offset }, - { "door_2.step_delay", &door_2.step_delay }, - { "door_2.anim_mode", &door_2.anim_mode }, + { "menu.fade_delay", &menu.fade_delay }, + { "menu.post_delay", &menu.post_delay }, - { "preview.x", &preview.x }, - { "preview.y", &preview.y }, - { "preview.xsize", &preview.xsize }, - { "preview.ysize", &preview.ysize }, - { "preview.tile_size", &preview.tile_size }, - { "preview.step_offset", &preview.step_offset }, - { "preview.step_delay", &preview.step_delay }, + { "door_1.width", &door_1.width }, + { "door_1.height", &door_1.height }, + { "door_1.step_offset", &door_1.step_offset }, + { "door_1.step_delay", &door_1.step_delay }, + { "door_1.anim_mode", &door_1.anim_mode }, + { "door_2.width", &door_2.width }, + { "door_2.height", &door_2.height }, + { "door_2.step_offset", &door_2.step_offset }, + { "door_2.step_delay", &door_2.step_delay }, + { "door_2.anim_mode", &door_2.anim_mode }, - { "game.panel.level.x", &game.panel.level.x }, - { "game.panel.level.y", &game.panel.level.y }, - { "game.panel.gems.x", &game.panel.gems.x }, - { "game.panel.gems.y", &game.panel.gems.y }, - { "game.panel.inventory.x", &game.panel.inventory.x }, - { "game.panel.inventory.y", &game.panel.inventory.y }, - { "game.panel.keys.x", &game.panel.keys.x }, - { "game.panel.keys.y", &game.panel.keys.y }, - { "game.panel.score.x", &game.panel.score.x }, - { "game.panel.score.y", &game.panel.score.y }, - { "game.panel.time.x", &game.panel.time.x }, - { "game.panel.time.y", &game.panel.time.y }, + { "preview.x", &preview.x }, + { "preview.y", &preview.y }, + { "preview.xsize", &preview.xsize }, + { "preview.ysize", &preview.ysize }, + { "preview.tile_size", &preview.tile_size }, + { "preview.step_offset", &preview.step_offset }, + { "preview.step_delay", &preview.step_delay }, - { "[player].boring_delay_fixed", &game.player_boring_delay_fixed }, - { "[player].boring_delay_random", &game.player_boring_delay_random }, - { "[player].sleeping_delay_fixed", &game.player_sleeping_delay_fixed }, - { "[player].sleeping_delay_random", &game.player_sleeping_delay_random }, + { "game.panel.level.x", &game.panel.level.x }, + { "game.panel.level.y", &game.panel.level.y }, + { "game.panel.gems.x", &game.panel.gems.x }, + { "game.panel.gems.y", &game.panel.gems.y }, + { "game.panel.inventory.x", &game.panel.inventory.x }, + { "game.panel.inventory.y", &game.panel.inventory.y }, + { "game.panel.keys.x", &game.panel.keys.x }, + { "game.panel.keys.y", &game.panel.keys.y }, + { "game.panel.score.x", &game.panel.score.x }, + { "game.panel.score.y", &game.panel.score.y }, + { "game.panel.time.x", &game.panel.time.x }, + { "game.panel.time.y", &game.panel.time.y }, - { NULL, NULL, } + { "[player].boring_delay_fixed", &game.player_boring_delay_fixed }, + { "[player].boring_delay_random", &game.player_boring_delay_random }, + { "[player].sleeping_delay_fixed", &game.player_sleeping_delay_fixed }, + { "[player].sleeping_delay_random", &game.player_sleeping_delay_random }, + + { NULL, NULL, } }; diff --git a/src/main.h b/src/main.h index a1b5d659..b4a34769 100644 --- a/src/main.h +++ b/src/main.h @@ -1815,6 +1815,11 @@ #define NUM_ENGINE_TYPES 3 +struct BorderInfo +{ + int draw_masked[NUM_SPECIAL_GFX_ARGS]; +}; + struct MenuInfo { int draw_xoffset[NUM_SPECIAL_GFX_ARGS]; @@ -2407,6 +2412,7 @@ extern struct LevelInfo level, level_template; extern struct HiScore highscore[]; extern struct TapeInfo tape; extern struct GlobalInfo global; +extern struct BorderInfo border; extern struct MenuInfo menu; extern struct DoorInfo door_1, door_2; extern struct PreviewInfo preview; diff --git a/src/screens.c b/src/screens.c index 09e02969..94c63b88 100644 --- a/src/screens.c +++ b/src/screens.c @@ -358,6 +358,7 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) graphic_info[IMG_TITLESCREEN_1].bitmap != NULL) { game_status = GAME_MODE_TITLE; + DrawTitleScreen(); return; @@ -431,6 +432,8 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) MapTapeButtons(); MapScreenMenuGadgets(SCREEN_MASK_MAIN); + DrawMaskedBorder(REDRAW_ALL); + if (do_fading) FadeIn(redraw_mask); else @@ -848,6 +851,8 @@ static void DrawInfoScreen_Main(boolean do_fading) PlayMenuSound(); PlayMenuMusic(); + DrawMaskedBorder(REDRAW_ALL); + if (do_fading) FadeIn(REDRAW_ALL); else diff --git a/src/tape.c b/src/tape.c index 0bdff153..1aaabf55 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1239,6 +1239,7 @@ void CreateTapeButtons() GDI_STATE, GD_BUTTON_UNPRESSED, GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y, GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y, + GDI_DIRECT_DRAW, FALSE, GDI_EVENT_MASK, GD_EVENT_RELEASED, GDI_CALLBACK_ACTION, HandleTapeButtons, GDI_END); diff --git a/src/tools.c b/src/tools.c index 7da6d255..21c53153 100644 --- a/src/tools.c +++ b/src/tools.c @@ -194,6 +194,63 @@ void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height) BlitBitmap(drawto, window, x, y, width, height, x, y); } +void DrawMaskedBorder_FIELD() +{ + if (game_status >= GAME_MODE_TITLE && + game_status <= GAME_MODE_PLAYING && + border.draw_masked[game_status]) + BlitBitmapMasked(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer, + REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, + REAL_SX, REAL_SY); +} + +void DrawMaskedBorder_DOOR_1() +{ + if (border.draw_masked[GFX_SPECIAL_ARG_DOOR] && + (game_status != GAME_MODE_EDITOR || + border.draw_masked[GFX_SPECIAL_ARG_EDITOR])) + BlitBitmapMasked(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer, + DX, DY, DXSIZE, DYSIZE, DX, DY); +} + +void DrawMaskedBorder_DOOR_2() +{ + if (border.draw_masked[GFX_SPECIAL_ARG_DOOR] && + game_status != GAME_MODE_EDITOR) + BlitBitmapMasked(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer, + VX, VY, VXSIZE, VYSIZE, VX, VY); +} + +void DrawMaskedBorder_DOOR_3() +{ + /* currently not available */ +} + +void DrawMaskedBorder_ALL() +{ + DrawMaskedBorder_FIELD(); + DrawMaskedBorder_DOOR_1(); + DrawMaskedBorder_DOOR_2(); + DrawMaskedBorder_DOOR_3(); +} + +void DrawMaskedBorder(int redraw_mask) +{ + if (redraw_mask & REDRAW_ALL) + DrawMaskedBorder_ALL(); + else + { + if (redraw_mask & REDRAW_FIELD) + DrawMaskedBorder_FIELD(); + if (redraw_mask & REDRAW_DOOR_1) + DrawMaskedBorder_DOOR_1(); + if (redraw_mask & REDRAW_DOOR_2) + DrawMaskedBorder_DOOR_2(); + if (redraw_mask & REDRAW_DOOR_3) + DrawMaskedBorder_DOOR_3(); + } +} + void BackToFront() { int x,y; @@ -260,6 +317,7 @@ void BackToFront() if (game_status != GAME_MODE_PLAYING || redraw_mask & REDRAW_FROM_BACKBUFFER) { + DrawMaskedBorder(REDRAW_FIELD); BlitBitmap(backbuffer, window, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, REAL_SX, REAL_SY); } @@ -278,7 +336,21 @@ void BackToFront() ABS(ScreenMovPos) == ScrollStepSize || redraw_tiles > REDRAWTILES_THRESHOLD) { +#if 1 + if (border.draw_masked[GFX_SPECIAL_ARG_MAIN]) + { + BlitBitmap(buffer, backbuffer, fx, fy, SXSIZE, SYSIZE, SX, SY); + + DrawMaskedBorder(REDRAW_FIELD); + BlitBitmap(backbuffer, window, + REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, + REAL_SX, REAL_SY); + } + else + BlitBitmap(buffer, window, fx, fy, SXSIZE, SYSIZE, SX, SY); +#else BlitBitmap(buffer, window, fx, fy, SXSIZE, SYSIZE, SX, SY); +#endif #if 0 #ifdef DEBUG @@ -302,13 +374,22 @@ void BackToFront() if (redraw_mask & REDRAW_DOORS) { if (redraw_mask & REDRAW_DOOR_1) + { + DrawMaskedBorder(REDRAW_DOOR_1); BlitBitmap(backbuffer, window, DX, DY, DXSIZE, DYSIZE, DX, DY); + } if (redraw_mask & REDRAW_DOOR_2) + { + DrawMaskedBorder(REDRAW_DOOR_2); BlitBitmap(backbuffer, window, VX, VY, VXSIZE, VYSIZE, VX, VY); + } if (redraw_mask & REDRAW_DOOR_3) + { + DrawMaskedBorder(REDRAW_DOOR_3); BlitBitmap(backbuffer, window, EX, EY, EXSIZE, EYSIZE, EX, EY); + } redraw_mask &= ~REDRAW_DOORS; } @@ -426,6 +507,7 @@ void FadeToFront() void FadeExt(int fade_mask, int fade_mode) { + void (*draw_border_function)(void) = NULL; Bitmap *bitmap = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_db_cross : NULL); int fade_delay = menu.fade_delay; int post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0); @@ -437,6 +519,8 @@ void FadeExt(int fade_mask, int fade_mode) y = REAL_SY; width = FULL_SXSIZE; height = FULL_SYSIZE; + + draw_border_function = DrawMaskedBorder_FIELD; } else /* REDRAW_ALL */ { @@ -458,7 +542,8 @@ void FadeExt(int fade_mask, int fade_mode) return; } - FadeRectangle(bitmap, x, y, width, height, fade_mode, fade_delay, post_delay); + FadeRectangle(bitmap, x, y, width, height, fade_mode, fade_delay, post_delay, + draw_border_function); redraw_mask &= ~fade_mask; } @@ -3093,6 +3178,7 @@ void CreateToolButtons() GDI_DECORATION_POSITION, deco_xpos, deco_ypos, GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY, GDI_DECORATION_SHIFTING, 1, 1, + GDI_DIRECT_DRAW, FALSE, GDI_EVENT_MASK, event_mask, GDI_CALLBACK_ACTION, HandleToolButtons, GDI_END); @@ -6002,23 +6088,45 @@ void PlayMenuMusic() void ToggleFullscreenIfNeeded() { + boolean change_fullscreen = (setup.fullscreen != + video.fullscreen_enabled); + boolean change_fullscreen_mode = (video.fullscreen_enabled && + !strEqual(setup.fullscreen_mode, + video.fullscreen_mode_current)); + + if (!video.fullscreen_available) + return; + +#if 1 + if (change_fullscreen || change_fullscreen_mode) +#else if (setup.fullscreen != video.fullscreen_enabled || setup.fullscreen_mode != video.fullscreen_mode_current) +#endif { Bitmap *tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); /* save backbuffer content which gets lost when toggling fullscreen mode */ BlitBitmap(backbuffer, tmp_backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); +#if 1 + if (change_fullscreen_mode) +#else if (setup.fullscreen && video.fullscreen_enabled) +#endif { - /* keep fullscreen mode, but change screen mode */ + /* keep fullscreen, but change fullscreen mode (screen resolution) */ +#if 1 + /* (this is now set in sdl.c) */ +#else video.fullscreen_mode_current = setup.fullscreen_mode; - video.fullscreen_enabled = FALSE; +#endif + video.fullscreen_enabled = FALSE; /* force new fullscreen mode */ } /* toggle fullscreen */ ChangeVideoModeIfNeeded(setup.fullscreen); + setup.fullscreen = video.fullscreen_enabled; /* restore backbuffer content from temporary backbuffer backup bitmap */ diff --git a/src/tools.h b/src/tools.h index 7a29b910..ec72a611 100644 --- a/src/tools.h +++ b/src/tools.h @@ -62,6 +62,13 @@ void DumpTile(int, int); +void DrawMaskedBorder_FIELD(); +void DrawMaskedBorder_DOOR_1(); +void DrawMaskedBorder_DOOR_2(); +void DrawMaskedBorder_DOOR_3(); +void DrawMaskedBorder_ALL(); +void DrawMaskedBorder(int); + void SetDrawtoField(int); void RedrawPlayfield(boolean, int, int, int, int); void BackToFront();