From: Holger Schemel Date: Wed, 24 Jun 2015 08:23:43 +0000 (+0200) Subject: fixed (un)drawing special editor door when it is not appropriate X-Git-Tag: 4.0.0.0-rc1~168 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=19f7fa07f264e8dbc4483028068c1d900eec5474;p=rocksndiamonds.git fixed (un)drawing special editor door when it is not appropriate --- diff --git a/src/tools.c b/src/tools.c index f76c8dce..5b830772 100644 --- a/src/tools.c +++ b/src/tools.c @@ -4437,6 +4437,29 @@ unsigned int MoveDoor(unsigned int door_state) return (door1 | door2); } +static boolean useSpecialEditorDoor() +{ + int graphic = IMG_GLOBAL_BORDER_EDITOR; + boolean redefined = getImageListEntryFromImageID(graphic)->redefined; + + // do not draw special editor door if editor border defined or redefined + if (graphic_info[graphic].bitmap != NULL || redefined) + return FALSE; + + // do not draw special editor door if global border defined to be empty + if (graphic_info[IMG_GLOBAL_BORDER].bitmap == NULL) + return FALSE; + + // do not draw special editor door if viewport definitions do not match + if (EX != VX || + EY >= VY || + EXSIZE != VXSIZE || + EY + EYSIZE != VY + VYSIZE) + return FALSE; + + return TRUE; +} + void DrawSpecialEditorDoor() { struct GraphicInfo *gfx1 = &graphic_info[IMG_DOOR_2_TOP_BORDER_CORRECTION]; @@ -4448,6 +4471,9 @@ void DrawSpecialEditorDoor() int vy = VY - outer_border; int exsize = EXSIZE + 2 * outer_border; + if (!useSpecialEditorDoor()) + return; + /* draw bigger level editor toolbox window */ BlitBitmap(gfx1->bitmap, drawto, gfx1->src_x, gfx1->src_y, top_border_width, top_border_height, ex, ey - top_border_height); @@ -4469,6 +4495,9 @@ void UndrawSpecialEditorDoor() int exsize = EXSIZE + 2 * outer_border; int eysize = EYSIZE + 2 * outer_border; + if (!useSpecialEditorDoor()) + return; + /* draw normal tape recorder window */ if (graphic_info[IMG_GLOBAL_BORDER].bitmap) {