X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=8610e5103476b976aa2731326f38226e22fb99a8;hb=2176d1de29652bc9e8db1baa283fdc1c4e99e674;hp=a212e6ade9846a182bf796ab05865ab96781ce22;hpb=dc4ee700e44e99a58d73e1ef8b549f3f859d3646;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index a212e6ad..8610e510 100644 --- a/src/tools.c +++ b/src/tools.c @@ -384,7 +384,8 @@ void DrawMaskedBorder(int redraw_mask) void DrawMaskedBorderToTarget(int draw_target) { - if (draw_target == DRAW_BORDER_TO_SCREEN) + if (draw_target == DRAW_BORDER_TO_BACKBUFFER || + draw_target == DRAW_BORDER_TO_SCREEN) { DrawMaskedBorderExt(REDRAW_ALL, draw_target); } @@ -397,7 +398,7 @@ void DrawMaskedBorderToTarget(int draw_target) global.border_status = gfx.fade_border_source_status; gfx.masked_border_bitmap_ptr = gfx.fade_bitmap_source; } - else + else if (draw_target == DRAW_BORDER_TO_FADE_TARGET) { global.border_status = gfx.fade_border_target_status; gfx.masked_border_bitmap_ptr = gfx.fade_bitmap_target; @@ -2427,7 +2428,6 @@ static void setRequestPosition(int *x, int *y, boolean add_border_size) void DrawEnvelopeRequest(char *text) { - int last_game_status = game_status; /* save current game status */ char *text_final = text; char *text_door_style = NULL; int graphic = IMG_BACKGROUND_REQUEST; @@ -2495,13 +2495,13 @@ void DrawEnvelopeRequest(char *text) tile_size, tile_size); /* force DOOR font inside door area */ - SetGameStatus(GAME_MODE_PSEUDO_DOOR); + SetFontStatus(GAME_MODE_PSEUDO_DOOR); DrawTextBuffer(sx + sx_offset, sy + sy_offset, text_final, font_nr, line_length, -1, max_lines, line_spacing, mask_mode, request.autowrap, request.centered, FALSE); - SetGameStatus(last_game_status); /* restore current game status */ + ResetFontStatus(); for (i = 0; i < NUM_TOOL_BUTTONS; i++) RedrawGadget(tool_gadget[i]); @@ -2860,7 +2860,6 @@ static void DrawPreviewLevelExt(boolean restart) boolean show_level_border = (BorderElement != EL_EMPTY); int level_xsize = lev_fieldx + (show_level_border ? 2 : 0); int level_ysize = lev_fieldy + (show_level_border ? 2 : 0); - int last_game_status = game_status; /* save current game status */ if (restart) { @@ -2906,8 +2905,6 @@ static void DrawPreviewLevelExt(boolean restart) DrawTextSAligned(pos->x, pos->y, label_text, font_nr, pos->align); } - SetGameStatus(last_game_status); /* restore current game status */ - return; } @@ -3007,8 +3004,6 @@ static void DrawPreviewLevelExt(boolean restart) DrawPreviewLevelLabelExt(label_state); } - - SetGameStatus(last_game_status); /* restore current game status */ } void DrawPreviewLevelInitial() @@ -3736,7 +3731,6 @@ static int RequestHandleEvents(unsigned int req_state) static boolean RequestDoor(char *text, unsigned int req_state) { unsigned int old_door_state; - int last_game_status = game_status; /* save current game status */ int max_request_line_len = MAX_REQUEST_LINE_FONT1_LEN; int font_nr = FONT_TEXT_2; char *text_ptr; @@ -3793,7 +3787,7 @@ static boolean RequestDoor(char *text, unsigned int req_state) DrawBackground(DX, DY, DXSIZE, DYSIZE); /* force DOOR font inside door area */ - SetGameStatus(GAME_MODE_PSEUDO_DOOR); + SetFontStatus(GAME_MODE_PSEUDO_DOOR); /* write text for request */ for (text_ptr = text, ty = 0; ty < MAX_REQUEST_LINES; ty++) @@ -3833,7 +3827,7 @@ static boolean RequestDoor(char *text, unsigned int req_state) // text_ptr += tl + (tc == ' ' || tc == '?' || tc == '!' ? 1 : 0); } - SetGameStatus(last_game_status); /* restore current game status */ + ResetFontStatus(); if (req_state & REQ_ASK) { @@ -8210,9 +8204,6 @@ void ToggleFullscreenOrChangeWindowScalingIfNeeded() { boolean change_fullscreen = (setup.fullscreen != video.fullscreen_enabled); - boolean change_fullscreen_mode = (video.fullscreen_enabled && - !strEqual(setup.fullscreen_mode, - video.fullscreen_mode_current)); boolean change_window_scaling_percent = (!video.fullscreen_enabled && setup.window_scaling_percent != video.window_scaling_percent); @@ -8242,7 +8233,6 @@ void ToggleFullscreenOrChangeWindowScalingIfNeeded() #endif if (change_fullscreen || - change_fullscreen_mode || change_window_scaling_percent) { Bitmap *tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); @@ -8250,12 +8240,6 @@ void ToggleFullscreenOrChangeWindowScalingIfNeeded() /* save backbuffer content which gets lost when toggling fullscreen mode */ BlitBitmap(backbuffer, tmp_backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); - if (change_fullscreen_mode) - { - /* keep fullscreen, but change fullscreen mode (screen resolution) */ - video.fullscreen_enabled = FALSE; /* force new fullscreen mode */ - } - if (change_window_scaling_percent) { /* keep window mode, but change window scaling */ @@ -8291,11 +8275,48 @@ void JoinRectangles(int *x, int *y, int *width, int *height, *height = MAX(*height, height2); } +void SetAnimStatus(int anim_status_new) +{ + if (anim_status_new == GAME_MODE_MAIN) + anim_status_new = GAME_MODE_PSEUDO_MAINONLY; + + global.anim_status_next = anim_status_new; + + // directly set screen modes that are entered without fading + if ((global.anim_status == GAME_MODE_PSEUDO_MAINONLY && + global.anim_status_next == GAME_MODE_PSEUDO_TYPENAME) || + (global.anim_status == GAME_MODE_PSEUDO_TYPENAME && + global.anim_status_next == GAME_MODE_PSEUDO_MAINONLY)) + global.anim_status = global.anim_status_next; +} + void SetGameStatus(int game_status_new) { game_status = game_status_new; - global.anim_status_next = game_status; + SetAnimStatus(game_status_new); +} + +void SetFontStatus(int game_status_new) +{ + static int last_game_status = -1; + + if (game_status_new != -1) + { + // set game status for font use after storing last game status + last_game_status = game_status; + game_status = game_status_new; + } + else + { + // reset game status after font use from last stored game status + game_status = last_game_status; + } +} + +void ResetFontStatus() +{ + SetFontStatus(-1); } void ChangeViewportPropertiesIfNeeded()