X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=326af5f9d8ea37dd725ecb623cb8f9ff9a44f886;hb=97baecdfcf386d972f6f8e6eec9ddfd3021ed7ed;hp=a5a3850e592e4df0b0f626fe87be9d8dff0a37c1;hpb=5a5ca477c9e938c8fdc728798efab02298fd8055;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index a5a3850e..326af5f9 100644 --- a/src/tools.c +++ b/src/tools.c @@ -251,6 +251,11 @@ void DrawMaskedBorder(int redraw_mask) effectiveGameStatus() == GAME_MODE_TITLE) return; + /* never draw masked screen borders when displaying request outside door */ + if (effectiveGameStatus() == GAME_MODE_PSEUDO_DOOR && + global.use_envelope_request) + return; + if (redraw_mask & REDRAW_ALL) DrawMaskedBorder_ALL(); else @@ -332,7 +337,7 @@ void BackToFront() SyncDisplay(); - /* prevent drawing masked border to backbuffer when using playfield buffer */ + /* never draw masked border to backbuffer when using playfield buffer */ if (game_status != GAME_MODE_PLAYING || redraw_mask & REDRAW_FROM_BACKBUFFER || buffer == backbuffer) @@ -795,8 +800,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); } @@ -2417,7 +2436,7 @@ void ShowEnvelopeDoor(char *text, int action) game.envelope_active = FALSE; #if 1 - game_status = last_game_status; /* restore current game status */ + // game_status = last_game_status; /* restore current game status */ if (action == ACTION_CLOSING) { @@ -2445,6 +2464,9 @@ void ShowEnvelopeDoor(char *text, int action) BackToFront(); + /* (important: after "BackToFront()", but before "SetDrawtoField()") */ + game_status = last_game_status; /* restore current game status */ + if (game_status == GAME_MODE_PLAYING && level.game_engine_type == GAME_ENGINE_TYPE_RND) SetDrawtoField(DRAW_BUFFERED); @@ -3378,13 +3400,14 @@ boolean Request(char *text, unsigned int req_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; - boolean use_envelope_request = TRUE * 0; #if 0 int max_word_len = 0; #endif char *text_ptr; int i; + global.use_envelope_request = TRUE * 1; + #if 1 if (maxWordLengthInString(text) > MAX_REQUEST_LINE_FONT1_LEN) { @@ -3440,13 +3463,21 @@ boolean Request(char *text, unsigned int req_state) UnmapAllGadgets(); -#if 1 - if (old_door_state & DOOR_OPEN_1 && !use_envelope_request) + /* draw released gadget before proceeding */ + // BackToFront(); + +#if 0 + if (old_door_state & DOOR_OPEN_1 && !global.use_envelope_request) #else if (old_door_state & DOOR_OPEN_1) #endif { +#if 1 + if (!global.use_envelope_request) + CloseDoor(DOOR_CLOSE_1); +#else CloseDoor(DOOR_CLOSE_1); +#endif /* save old door content */ BlitBitmap(bitmap_db_door, bitmap_db_door, @@ -3502,7 +3533,7 @@ boolean Request(char *text, unsigned int req_state) game_status = last_game_status; /* restore current game status */ #if 1 - if (use_envelope_request) + if (global.use_envelope_request) { /* !!! TMP !!! */ FreeToolButtons(); @@ -3533,7 +3564,7 @@ boolean Request(char *text, unsigned int req_state) DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); #if 1 - if (use_envelope_request) + if (global.use_envelope_request) { ShowEnvelopeDoor(text, ACTION_OPENING); @@ -3557,7 +3588,7 @@ boolean Request(char *text, unsigned int req_state) #endif #if 1 - if (!use_envelope_request) + if (!global.use_envelope_request) OpenDoor(DOOR_OPEN_1); #else OpenDoor(DOOR_OPEN_1); @@ -3579,7 +3610,7 @@ boolean Request(char *text, unsigned int req_state) } #if 1 - if (game_status != GAME_MODE_MAIN && !use_envelope_request) + if (game_status != GAME_MODE_MAIN && !global.use_envelope_request) InitAnimation(); #else if (game_status != GAME_MODE_MAIN) @@ -3721,8 +3752,16 @@ boolean Request(char *text, unsigned int req_state) Delay(10); } +#if 1 + game_status = GAME_MODE_PSEUDO_DOOR; +#endif + BackToFront(); +#if 1 + game_status = last_game_status; /* restore current game status */ +#endif + #else DoAnimation(); @@ -3744,12 +3783,12 @@ boolean Request(char *text, unsigned int req_state) UnmapToolButtons(); #if 1 - if (use_envelope_request) + if (global.use_envelope_request) ShowEnvelopeDoor(text, ACTION_CLOSING); #endif #if 1 - if (!(req_state & REQ_STAY_OPEN) && !use_envelope_request) + if (!(req_state & REQ_STAY_OPEN) && !global.use_envelope_request) #else if (!(req_state & REQ_STAY_OPEN)) #endif