From: Holger Schemel Date: Sat, 2 Dec 2023 13:32:47 +0000 (+0100) Subject: moved code to separate function X-Git-Tag: 4.3.8.0~17 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=507d04844c31765e258da41a04f323b5f65f7c04;p=rocksndiamonds.git moved code to separate function --- diff --git a/src/tools.c b/src/tools.c index 3ffbdad1..40ac8d37 100644 --- a/src/tools.c +++ b/src/tools.c @@ -4840,43 +4840,22 @@ static void DoRequestAfter(void) TapeDeactivateDisplayOn(); } -static boolean RequestDoor(char *text, unsigned int req_state) +static void DrawRequestDoorText(char *text) { - int draw_buffer_last = GetDrawtoField(); - unsigned int old_door_state = GetDoorState(); + char *text_ptr = text; int max_request_line_len = MAX_REQUEST_LINE_FONT1_LEN; int font_nr = FONT_TEXT_2; - char *text_ptr; - int result; int ty; + // force DOOR font inside door area + SetFontStatus(GAME_MODE_PSEUDO_DOOR); + if (maxWordLengthInRequestString(text) > MAX_REQUEST_LINE_FONT1_LEN) { max_request_line_len = MAX_REQUEST_LINE_FONT2_LEN; font_nr = FONT_TEXT_1; } - DoRequestBefore(); - - if (old_door_state & DOOR_OPEN_1) - { - CloseDoor(DOOR_CLOSE_1); - - // save old door content - BlitBitmap(bitmap_db_door_1, bitmap_db_door_1, - 0, 0, DXSIZE, DYSIZE, DXSIZE, 0); - } - - SetDoorBackgroundImage(IMG_BACKGROUND_DOOR); - SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1); - - // clear door drawing field - DrawBackground(DX, DY, DXSIZE, DYSIZE); - - // force DOOR font inside door area - SetFontStatus(GAME_MODE_PSEUDO_DOOR); - - // write text for request for (text_ptr = text, ty = 0; ty < MAX_REQUEST_LINES; ty++) { char text_line[max_request_line_len + 1]; @@ -4913,6 +4892,33 @@ static boolean RequestDoor(char *text, unsigned int req_state) } ResetFontStatus(); +} + +static boolean RequestDoor(char *text, unsigned int req_state) +{ + int draw_buffer_last = GetDrawtoField(); + unsigned int old_door_state = GetDoorState(); + int result; + + DoRequestBefore(); + + if (old_door_state & DOOR_OPEN_1) + { + CloseDoor(DOOR_CLOSE_1); + + // save old door content + BlitBitmap(bitmap_db_door_1, bitmap_db_door_1, + 0, 0, DXSIZE, DYSIZE, DXSIZE, 0); + } + + SetDoorBackgroundImage(IMG_BACKGROUND_DOOR); + SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1); + + // clear door drawing field + DrawBackground(DX, DY, DXSIZE, DYSIZE); + + // write text for request + DrawRequestDoorText(text); MapToolButtons(req_state);