This is a really very good and useful idea! And I highly appreciated your pull request, which I could add nearly without changes to the R'n'D code base -- thanks a lot for this great contribution!
In your pull request description text, you wondered how to update the brush after flipping or rotating:
I guess it's necessary to re-draw the brush properly after changing it. Any help on how to achieve this is highly welcome
I have attached the final commit that implements flipping and rotating brushes in the level editor; more or less, your really only needed an additional
Code: Select all
CopyBrushExt(last_cursor_x, last_cursor_y, 0, 0, 0, CB_BRUSH_TO_CURSOR);
to update the screen with the flipped or rotated brush. For rotating the brush, which may change its x/y size, you also have to temporarily delete the brush first using
Code: Select all
CopyBrushExt(0, 0, 0, 0, 0, CB_DELETE_OLD_CURSOR);
which can be seen in the patch file, too.
As the key shortcuts of the level editor of R'n'D are highly based on those of good old Deluxe Paint on the Amiga, I also used the "x", "y" and "z" keys for flipping (mirroring) the brush in x and y direction and to rotate the brush clockwise by 90° (which was in fact "x" for x-flipping, "z" for "y-flipping" and "y" for rotating clockwise in Deluxe Paint for strange/unknown reasons, so I used the more logical ones from the DPaint clone "GrafX2", which uses the shortcuts I also use in R'n'D's editor now.)
OK, so we now can flip and rotate brushes. That's very nice indeed! But: What's immediately apparent when using this new feature is that while brushes are flipped/rotated, tiles (game elements) are not!
This is not only true for enemies starting to move in some direction, but especially apparent when using some sophisticated patterns using the DX style connected tubes or the DC style decorated steel walls. Or things like expanding walls. Or conveyor belts. And when editing MM style levels, the new feature really does not work well with all those sub-tile walls, which are just placed at wrong (or at least very unexpected) locations after flipping or rotating.
So I complemented the new feature with tiles/elements of the flipped/rotated brushes also being correctly flipped and rotated, and now the new feature really starts to be fun and be even more useful!
I've added this second patch, too. Have fun!
Update: Forgot to mention that I skipped the shortcut for XY flipping the brush, which I think won't be needed too often, and which can easily be emulated by just pressing "x" and "z" instead (to x-flip and rotate the brush).