X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=8954a19dc9ac9d33371ea95e06485e51c97a699d;hb=2486a7a849210371bb59e733e37b0271a4332d8b;hp=21728e5a081efa7910da8dbcb3bfdf0f07c39c22;hpb=08077278b4277434ebbeb0e828cf45f9ce9ee387;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 21728e5a..8954a19d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -437,6 +437,8 @@ void BlitScreenToBitmap(Bitmap *target_bitmap) { DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field); int fx = FX, fy = FY; + int full_lev_fieldx = lev_fieldx + (BorderElement != EL_EMPTY ? 2 : 0); + int full_lev_fieldy = lev_fieldy + (BorderElement != EL_EMPTY ? 2 : 0); #if NEW_TILESIZE int dx = (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0); @@ -487,6 +489,28 @@ void BlitScreenToBitmap(Bitmap *target_bitmap) fx, fy); #endif +#if 1 + if (full_lev_fieldx <= SCR_FIELDX) + { + // printf(":1: PLAYFIELD FITS TO SCREEN [%d, %d, %d]\n", fx, ffx, dx_var); + + if (EVEN(SCR_FIELDX)) + fx = 2 * TILEX_VAR - (ODD(lev_fieldx) ? TILEX_VAR / 2 : 0); + else + fx = 2 * TILEX_VAR - (EVEN(lev_fieldx) ? TILEX_VAR / 2 : 0); + + // printf(":2: PLAYFIELD FITS TO SCREEN [%d, %d, %d]\n", fx, ffx, dx_var); + } + + if (full_lev_fieldy <= SCR_FIELDY) + { + if (EVEN(SCR_FIELDY)) + fy = 2 * TILEY_VAR - (ODD(lev_fieldy) ? TILEY_VAR / 2 : 0); + else + fy = 2 * TILEY_VAR - (EVEN(lev_fieldy) ? TILEY_VAR / 2 : 0); + } +#endif + if (border.draw_masked[GAME_MODE_PLAYING]) { if (buffer != backbuffer) @@ -1017,11 +1041,28 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type) ClearRectangle(backbuffer, x, y, width, height); #endif +#if 1 + +#if 1 + BlitBitmap(backbuffer, window, x, y, width, height, x, y); + + redraw_mask &= ~fade_mask; +#else + /* always redraw area that was explicitly marked to fade */ + redraw_mask |= fade_mask; + + BackToFront(); +#endif + +#else + #if 1 BlitBitmap(backbuffer, window, x, y, width, height, x, y); redraw_mask = REDRAW_NONE; + // (^^^ WRONG; should be "redraw_mask &= ~fade_mask" if done this way) #else BackToFront(); +#endif #endif return; @@ -2972,10 +3013,11 @@ void AnimateEnvelopeRequest(int anim_mode, int action) dst_x + xsize_size_left, dst_y + ysize_size_top); #endif -#if 1 +#if 0 redraw_mask = REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; // redraw_mask |= REDRAW_ALL | REDRAW_FROM_BACKBUFFER; #else + /* CHECK AGAIN (previous code reactivated) */ redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER; #endif @@ -3317,6 +3359,11 @@ void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) #if 1 // game_status = last_game_status; /* restore current game status */ +#if 1 + /* !!! CHECK AGAIN (SEE BELOW) !!! */ + game_status = last_game_status; /* restore current game status */ +#endif + if (action == ACTION_CLOSING) { if (game_status != GAME_MODE_MAIN) @@ -3330,10 +3377,11 @@ void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) // SetDrawBackgroundMask(last_draw_background_mask); -#if 1 +#if 0 redraw_mask = REDRAW_FIELD; // redraw_mask |= REDRAW_ALL; #else + /* CHECK AGAIN (previous code reactivated) */ redraw_mask |= REDRAW_FIELD; #endif @@ -3343,8 +3391,10 @@ void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) BackToFront(); +#if 0 /* (important: after "BackToFront()", but before "SetDrawtoField()") */ game_status = last_game_status; /* restore current game status */ +#endif #if 1 if (action == ACTION_CLOSING && @@ -5702,6 +5752,7 @@ unsigned int MoveDoor(unsigned int door_state) if (door_state & DOOR_ACTION) { boolean door_panel_drawn[NUM_DOORS]; + boolean panel_has_doors[NUM_DOORS]; boolean door_part_skip[MAX_DOOR_PARTS]; boolean door_part_done[MAX_DOOR_PARTS]; boolean door_part_done_all; @@ -5712,6 +5763,9 @@ unsigned int MoveDoor(unsigned int door_state) int current_move_delay = 0; int k; + for (i = 0; i < NUM_DOORS; i++) + panel_has_doors[i] = FALSE; + for (i = 0; i < MAX_DOOR_PARTS; i++) { struct DoorPartControlInfo *dpc = &door_part_controls[i]; @@ -5742,6 +5796,7 @@ unsigned int MoveDoor(unsigned int door_state) struct DoorPartPosInfo *pos = dpc->pos; struct GraphicInfo *g = &graphic_info[dpc->graphic]; int door_token = dpc->door_token; + int door_index = DOOR_INDEX_FROM_TOKEN(door_token); boolean is_panel = DOOR_PART_IS_PANEL(nr); int step_xoffset = ABS(pos->step_xoffset); int step_yoffset = ABS(pos->step_yoffset); @@ -5764,6 +5819,9 @@ unsigned int MoveDoor(unsigned int door_state) if (door_part_skip[nr]) continue; + if (!is_panel) + panel_has_doors[door_index] = TRUE; + max_move_delay = MAX(max_move_delay, move_delay); max_step_delay = (max_step_delay == 0 ? step_delay : euclid(max_step_delay, step_delay)); @@ -6009,9 +6067,16 @@ unsigned int MoveDoor(unsigned int door_state) door_part_done[nr] = TRUE; #endif +#if 1 + // continue door part animations, but not panel after door has closed + if (!door_part_done[nr] && + !(is_panel && door_closing && panel_has_doors[door_index])) + door_part_done_all = FALSE; +#else // continue door part animations, but not panel after door has closed if (!door_part_done[nr] && !(is_panel && door_closing)) door_part_done_all = FALSE; +#endif #if 0 if (!door_part_done[nr]) @@ -11271,9 +11336,13 @@ void ChangeViewportPropertiesIfNeeded() int *door_2_x = (game_status == GAME_MODE_EDITOR ? &EX : &VX); int *door_2_y = (game_status == GAME_MODE_EDITOR ? &EY : &VY); #endif +#if 1 + int gfx_game_mode = game_status; +#else int gfx_game_mode = (game_status == GAME_MODE_PLAYING || game_status == GAME_MODE_EDITOR ? game_status : GAME_MODE_MAIN); +#endif int gfx_game_mode2 = (game_status == GAME_MODE_EDITOR ? GAME_MODE_DEFAULT : game_status); struct RectWithBorder *vp_playfield = &viewport.playfield[gfx_game_mode];