From 44ea56baf25f0de851159707ffef7f43a220c029 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 6 Nov 2017 23:22:13 +0100 Subject: [PATCH] you can now hold in map editor to paint multiple cells --- control.cpp | 5 +++++ hyper.h | 1 + mapeditor.cpp | 10 +++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/control.cpp b/control.cpp index 361d489e..d53d912e 100644 --- a/control.cpp +++ b/control.cpp @@ -8,6 +8,8 @@ bool leftclick, rightclick, targetclick, hiliteclick, anyshiftclick, wheelclick, forcetarget, lshiftclick, lctrlclick; bool gtouched; +bool holdmouse; + int getcstat, lgetcstat; ld getcshift; bool inslider; function keyhandler; @@ -638,6 +640,7 @@ void mainloopiter() { mousepressed = ev.type == SDL_MOUSEBUTTONDOWN; if(mousepressed) flashMessages(); mousing = true; + holdmouse = false; bool act = false; @@ -710,6 +713,8 @@ void mainloopiter() { else #endif mouseh = gethyper(mousex, mousey); + + if(holdmouse && getcstat == '-') sym = uni = getcstat; if((rightclick || (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MMASK)) && !mouseout2() && mouseh[2] < 50 && mouseoh[2] < 50) { diff --git a/hyper.h b/hyper.h index 9cb20eca..3365316e 100644 --- a/hyper.h +++ b/hyper.h @@ -2109,3 +2109,4 @@ template void generateLandList(T t); int isLandValid(eLand l); bool inmirrororwall(eLand l); +extern bool holdmouse; diff --git a/mapeditor.cpp b/mapeditor.cpp index e2249997..96746750 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -421,8 +421,10 @@ namespace mapeditor { } else if(u < 2) return 0; - + +#if LOCAL printf("unhandled: u=%d\n", u); +#endif } } return 0; @@ -1162,9 +1164,11 @@ namespace mapeditor { handlePanning(sym, uni); // left-clicks are coded with '-', and right-clicks are coded with sym F1 - if(uni == '-') undoLock(); - if(uni == '-' && mouseover) + if(uni == '-' && !holdmouse) undoLock(); + if(uni == '-' && mouseover) { allInPattern(mouseover, radius, neighborId(mouseover, mouseover2)); + holdmouse = true; + } if(mouseover) for(int i=0; itype; i++) createMov(mouseover, i); if(uni == 'u') applyUndo();