From: Holger Schemel Date: Sat, 2 Feb 2019 17:07:21 +0000 (+0100) Subject: fixed bug when using Shift+click (IntelliDraw) in editor using empty space X-Git-Tag: 4.1.2.0~38 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=1be3e5c990b84f8548a80ccd6b7b209a88312141 fixed bug when using Shift+click (IntelliDraw) in editor using empty space Using "empty space" as the drawing element in the level editor caused "high resolution" (half tile size) drawing even if the element under the cursor is not a "high resolution" (Mirror Magic style) element, causing buggy drawing when using "IntelliDraw" (Shift+click) drawing. --- diff --git a/src/editor.c b/src/editor.c index 1c7edbea..12562f76 100644 --- a/src/editor.c +++ b/src/editor.c @@ -11660,11 +11660,21 @@ static void ResetIntelliDraw(void) static boolean draw_mode_hires = FALSE; +static boolean isHiresTileElement(int element) +{ + return (IS_MM_WALL(element) || element == EL_EMPTY); +} + +static boolean isHiresDrawElement(int element) +{ + return (IS_MM_WALL_EDITOR(element) || element == EL_EMPTY); +} + static void SetDrawModeHiRes(int element) { draw_mode_hires = (level.game_engine_type == GAME_ENGINE_TYPE_MM && - (IS_MM_WALL_EDITOR(element) || element == EL_EMPTY)); + isHiresDrawElement(element)); } static boolean getDrawModeHiRes(void) @@ -12705,9 +12715,13 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) } else if (!button_press_event) { + int old_element = (IN_LEV_FIELD(lx, ly) ? Feld[lx][ly] : EL_UNDEFINED); + boolean hires_drawing = (level.game_engine_type == GAME_ENGINE_TYPE_MM && + isHiresTileElement(old_element) && + isHiresDrawElement(new_element)); + // prevent handling events for every pixel position when moving mouse - if ((sx == last_sx && sy == last_sy && - !IS_MM_WALL_EDITOR(new_element) && new_element != EL_EMPTY) || + if ((sx == last_sx && sy == last_sy && !hires_drawing) || (sx2 == last_sx2 && sy2 == last_sy2)) return; }