Skip to content

Improve: add door symbol display to custom exits lines and to stubs#4608

Merged
SlySven merged 13 commits intoMudlet:developmentfrom
SlySven:Enhance_addDoorSymbolDisplayToCustomExitsLinesAndToStubs
Dec 14, 2021
Merged

Improve: add door symbol display to custom exits lines and to stubs#4608
SlySven merged 13 commits intoMudlet:developmentfrom
SlySven:Enhance_addDoorSymbolDisplayToCustomExitsLinesAndToStubs

Conversation

@SlySven
Copy link
Copy Markdown
Member

@SlySven SlySven commented Jan 11, 2021

This PR will also allow colors for open/closed/locked doors to be customised in the future (by adjusting the new T2DMap QColor members: mOpenDoorColor, mClosedDoorColor and mLockedDoorColor.

Moved the QMap<int, QPoint> mAreaExitsList member out of the class header - it is now a local areaExitsList value held in the paintEvent(...) method and passed by reference to a couple of paint helper methods.

Revise the code that painted exit stubs as the formulas being used to work out the inner and outer points on the line were wrong - and as they were dependent on the room size the stubs changed as the room size did. Since we may now be painting a door marker on them it is easier if the length is constant and does not depend on the room size.

Since we are now able to show door markings on custom exit lines (including on special exits) and stub exits the tool-tips in the room exits control panel are updated to now reflect this.

This will close #499 which is the same as an issue that Fuligin raised in the Discord #help channel on 2021/01/08 and close #668.

Signed-off-by: Stephen Lyons slysven@virginmedia.com

This PR will also allow colors for open/closed/locked doors to be
customised in the future (by adjusting the new `T2DMap` `QColor`
members: `mOpenDoorColor`, `mClosedDoorColor` and `mLockedDoorColor`.

Moved the `QMap<int, QPoint> mAreaExitsList` member out of the class header
- it is now a local `areaExitsList` value held in the `paintEvent(...)`
method and passed by reference to a couple of paint helper methods.

Revise the code that painted exit stubs as the formulas being used to work
out the inner and outer points on the line were wrong - and as they were
dependent on the room size the stubs changed as the room size did. Since
we may now be painting a door marker on them it is easier if the length is
constant and does not depend on the room size.

Since we are now able to show door markings on custom exit lines (including
on special exits) and stub exits the tool-tips in the room exits control
panel is updated to now reflect this.

This will close Mudlet#499 and close Mudlet#668 and address an issue that Fuligin
raised in the Discord # help channel on 2021/01/08 .

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven requested a review from a team as a code owner January 11, 2021 06:46
@SlySven SlySven requested a review from a team January 11, 2021 06:46
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Jan 11, 2021

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jan 11, 2021

Also a comment I made in another issue #2427 (comment) describes the sort of thing that I have finally done...

This actually doubles the amount that area exits stick out from the
starting room and revises the drawing code so that it is not so dependent
on the room size (which modified the `exitWidth` local that the code was
using). The particular detail that required this commit was that the way
that the underlying line was drawn that was used to derive the door symbol
from had the start and end points the opposite way around to that which I
had developed the code for!

Whilst cleaning things up I spotted that there was a redundant conversion
from a `QPointF` to a `QPoint` and then back to a `QPointF` when handling
the area exit click location - that is used to record when an area exit is
(double) clicked upon to initiate a speedwalk to the room in the adjacent
area.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Copy link
Copy Markdown
Contributor

@Delwing Delwing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good imho.

Although I must admit that I would like non-curve doors.

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Jan 13, 2021

What would you like to see?

@Delwing
Copy link
Copy Markdown
Contributor

Delwing commented Jan 13, 2021

Some straight lines :) But this is just a matter of taste I guess.

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jan 16, 2021

They were shaped so that when the two rooms are close together and only one direction has a door it is clear to see which direction it applies to...

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Jan 17, 2021

That's a good point, but majority of the doors are two way, and it does look like a funny little chromosome now. Do you think it can be improved?

@Delwing
Copy link
Copy Markdown
Contributor

Delwing commented Jan 17, 2021

How about shape like that? Line with a little triangle in the middle indicating way in case of one way door.

|
|\
|/
|

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jan 17, 2021

Actually the simplest modification would be to take out the middle section so that you have a pair of "outward opening" doors, either side of the exit line:

 \
===== <- Exit line (this side is away from exit room
 /

... Line with a little triangle in the middle indicating way in case of one way door.

Since the two directions are handled separately (as they are each associated with the room the exit leaves from) trying to do that would get more complicated and involved - it would require trying to determine whether the exit was an area exit (which by definition is treated as one way even when it isn't) and whether it was a two or one way exit otherwise...

As requested during review.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@Delwing
Copy link
Copy Markdown
Contributor

Delwing commented Jan 20, 2021

Something more happened to map rendering code.
Fresh PTB on the left (same on release version)
This branch's build on the right.
Looks like some out of view decisions come too early additionally this broken line to that location... they persist even on the middle and when moving room.

image
image
image

@SlySven SlySven marked this pull request as draft January 20, 2021 21:40
@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jan 20, 2021

I agree something is wrong - note that when the destination room is off the map then there should now still be half a line going towards it from the room that is on the map - in the past I think there could have been some cases where the whole line was missed out.

🤔

... also, it does seem to be a bit arbitrary as to the room(s) that this is going wrong for!

@Delwing
Copy link
Copy Markdown
Contributor

Delwing commented Jan 20, 2021

Yeah, strange.
Whole line gets missing sometimes for custom lines (usually when target room is out of view if I recall correctly), but for regular exits haven't had any issues recently.

@vadi2 vadi2 assigned SlySven and unassigned vadi2, Kebap and itsTheFae Jan 25, 2021
@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jan 29, 2021

@Delwing do you have a small test map that reproduces this. I've gone looking for it and haven't spotted the bug currently but I agree it is there somewhere...

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Jan 29, 2021

You can find it in https://github.com/IRE-Mudlet-Mapping/AchaeaCrowdmap/blob/gh-pages/Map/map, have a look at room 11122.

@Delwing
Copy link
Copy Markdown
Contributor

Delwing commented Jan 29, 2021

@SlySven SlySven marked this pull request as ready for review January 30, 2021 01:45
…xitsLinesAndToStubs

Needed to pull in exit line drawing bug fix.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
…xitsLinesAndToStubs

Needed to include fix for crashing on exit in TTimerUnit destructor.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Make them a bit (150%) thicker and a little longer.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@Jieiku
Copy link
Copy Markdown
Contributor

Jieiku commented Feb 12, 2021

This looks exciting!

…xitsLinesAndToStubs

Conflicts resolved in:
* src/T2DMap.h
* src/TMap.cpp
* src/TRoom.h

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Copy link
Copy Markdown
Member

@keneanung keneanung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI text changes seem good to me. I didn't delve into the C++ part, though.

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 50. Check the log or trigger a new build to see more.

}

void T2DMap::paintAreaExits(QPainter& painter, QPen& pen, QList<int>& exitList, QList<int>& oneWayExits, const TArea* pArea, int zLevel, float exitWidth)
void T2DMap::drawDoor(QPainter& painter, const TRoom& room, const QString& dirKey, const QLineF& exitLine)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method drawDoor can be made const [readability-make-member-function-const]

void T2DMap::drawDoor(QPainter& painter, const TRoom& room, const QString& dirKey, const QLineF& exitLine)
             ^
                                                                                                           const

src/T2DMap.cpp Outdated
if (room->getSouth() == rID) {
_line = QLine(p2.x(), p2.y() + mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x(), p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x(), p2.y() + 2.0 * mRoomHeight,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

line = QLine(p2.x(), p2.y() + 2.0 * mRoomHeight,
             ^

src/T2DMap.cpp Outdated
if (room->getSouth() == rID) {
_line = QLine(p2.x(), p2.y() + mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x(), p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x(), p2.y() + 2.0 * mRoomHeight,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from double to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

line = QLine(p2.x(), p2.y() + 2.0 * mRoomHeight,
                     ^

src/T2DMap.cpp Outdated
_line = QLine(p2.x(), p2.y() + mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x(), p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x(), p2.y() + 2.0 * mRoomHeight,
p2.x(), p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

p2.x(), p2.y());
^

src/T2DMap.cpp Outdated
_line = QLine(p2.x(), p2.y() + mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x(), p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x(), p2.y() + 2.0 * mRoomHeight,
p2.x(), p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

p2.x(), p2.y());
        ^

src/T2DMap.cpp Outdated
} else if (room->getEast() == rID) {
_line = QLine(p2.x() + mRoomWidth, p2.y(), p2.x(), p2.y());
_p = QPoint(p2.x() + mRoomWidth / 2.0, p2.y());
line = QLine(p2.x() + 2.0 * mRoomWidth, p2.y(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

line = QLine(p2.x() + 2.0 * mRoomWidth, p2.y(),
                                        ^

src/T2DMap.cpp Outdated
_line = QLine(p2.x() + mRoomWidth, p2.y(), p2.x(), p2.y());
_p = QPoint(p2.x() + mRoomWidth / 2.0, p2.y());
line = QLine(p2.x() + 2.0 * mRoomWidth, p2.y(),
p2.x(), p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

p2.x(), p2.y());
^

src/T2DMap.cpp Outdated
_line = QLine(p2.x() + mRoomWidth, p2.y(), p2.x(), p2.y());
_p = QPoint(p2.x() + mRoomWidth / 2.0, p2.y());
line = QLine(p2.x() + 2.0 * mRoomWidth, p2.y(),
p2.x(), p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

p2.x(), p2.y());
        ^

src/T2DMap.cpp Outdated
_p = QPoint(p2.x() + mRoomWidth / 2.0, p2.y());
line = QLine(p2.x() + 2.0 * mRoomWidth, p2.y(),
p2.x(), p2.y());
clickPoint = QPoint(p2.x() + mRoomWidth, p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

clickPoint = QPoint(p2.x() + mRoomWidth, p2.y());
                    ^

src/T2DMap.cpp Outdated
_p = QPoint(p2.x() + mRoomWidth / 2.0, p2.y());
line = QLine(p2.x() + 2.0 * mRoomWidth, p2.y(),
p2.x(), p2.y());
clickPoint = QPoint(p2.x() + mRoomWidth, p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

clickPoint = QPoint(p2.x() + mRoomWidth, p2.y());
                                         ^

@demonnic demonnic changed the title Enhance: add door symbol display to custom exits lines and to stubs Improve: add door symbol display to custom exits lines and to stubs Oct 15, 2021
Conflicts resolved in:
* src/T2DMap.cpp
* src/T2DMap.h
* src/TRoom.cpp
* src/TRoom.h
* src/dlgRoomExits.cpp
* src/ui/room_exits.ui

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 27, 2021

Messages
✔️

PR type: Improvement

Generated by 🚫 dangerJS against db832d9

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/T2DMap.cpp Outdated
} else if (room->getNorthwest() == rID) {
_line = QLine(p2.x() - mRoomWidth, p2.y() - mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() - mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() - 2.0 * mRoomHeight,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from double to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() - 2.0 * mRoomHeight,
             ^

src/T2DMap.cpp Outdated
} else if (room->getNorthwest() == rID) {
_line = QLine(p2.x() - mRoomWidth, p2.y() - mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() - mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() - 2.0 * mRoomHeight,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from double to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() - 2.0 * mRoomHeight,
                                        ^

src/T2DMap.cpp Outdated
_line = QLine(p2.x() - mRoomWidth, p2.y() - mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() - mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() - 2.0 * mRoomHeight,
p2.x(), p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

p2.x(), p2.y());
^

src/T2DMap.cpp Outdated
_line = QLine(p2.x() - mRoomWidth, p2.y() - mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() - mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() - 2.0 * mRoomHeight,
p2.x(), p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

p2.x(), p2.y());
        ^

src/T2DMap.cpp Outdated
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() - mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() - 2.0 * mRoomHeight,
p2.x(), p2.y());
clickPoint = QPoint(p2.x() - mRoomWidth, p2.y() - mRoomHeight);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

clickPoint = QPoint(p2.x() - mRoomWidth, p2.y() - mRoomHeight);
                    ^

src/T2DMap.cpp Outdated
} else if (room->getSouthwest() == rID) {
_line = QLine(p2.x() - mRoomWidth, p2.y() + mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() + 2.0 * mRoomHeight,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from double to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() + 2.0 * mRoomHeight,
                                        ^

src/T2DMap.cpp Outdated
_line = QLine(p2.x() - mRoomWidth, p2.y() + mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() + 2.0 * mRoomHeight,
p2.x(), p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

p2.x(), p2.y());
^

src/T2DMap.cpp Outdated
_line = QLine(p2.x() - mRoomWidth, p2.y() + mRoomHeight, p2.x(), p2.y());
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() + 2.0 * mRoomHeight,
p2.x(), p2.y());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

p2.x(), p2.y());
        ^

src/T2DMap.cpp Outdated
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() + 2.0 * mRoomHeight,
p2.x(), p2.y());
clickPoint = QPoint(p2.x() - mRoomWidth, p2.y() + mRoomHeight);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

clickPoint = QPoint(p2.x() - mRoomWidth, p2.y() + mRoomHeight);
                    ^

src/T2DMap.cpp Outdated
_p = QPoint(p2.x() - mRoomWidth / 2.0, p2.y() + mRoomHeight / 2.0);
line = QLine(p2.x() - 2.0 * mRoomWidth, p2.y() + 2.0 * mRoomHeight,
p2.x(), p2.y());
clickPoint = QPoint(p2.x() - mRoomWidth, p2.y() + mRoomHeight);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from float to int [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]

clickPoint = QPoint(p2.x() - mRoomWidth, p2.y() + mRoomHeight);
                                         ^

In fact one of the terms "statics" was correct because it was referring to
multiple variables of a certain scope, but rephrasing the sentence avoids
offending the *smelling misteak* Bot!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
…dy Bot

It seemed to be unhappy about "narrowing conversions" of `double`s to
`int`s. when a local line and point with integer coordinates are created
- and which are then used to create others which have floating point
values.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Dec 14, 2021

I say merge it and see how people take to this!

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Dec 14, 2021

Okay, I'll publish and be damned...!

@SlySven SlySven merged commit 7301bcd into Mudlet:development Dec 14, 2021
@SlySven SlySven deleted the Enhance_addDoorSymbolDisplayToCustomExitsLinesAndToStubs branch December 14, 2021 16:32
@Jieiku
Copy link
Copy Markdown
Contributor

Jieiku commented Dec 14, 2021

Very cool! do these changes perhaps prelude to: #2427
I remember you saying that you had some code you were working on that would allow for this, but you had not yet finished it.

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Dec 14, 2021

I remember you saying that you had some code you were working on that would allow for this, but you had not yet finished it.

I think that was a long time ago on a PC far, far no longer in use! Even if I could get into a spot of archaeology I suspect I'd be better off starting from scratch with the 2D map code as it is now - OTOH it is nearly Christmas and I do have more spare time at the moment so maybe I get around to it.

vadi2 pushed a commit to SlySven/Mudlet that referenced this pull request Jan 17, 2022
…udlet#4608)

This PR will also allow colors for open/closed/locked doors to be
customised in the future (by adjusting the new `T2DMap` `QColor`
members: `mOpenDoorColor`, `mClosedDoorColor` and `mLockedDoorColor`.

Moved the `QMap<int, QPoint> mAreaExitsList` member out of the class header
- it is now a local `areaExitsList` value held in the `paintEvent(...)`
method and passed by reference to a couple of paint helper methods.

Revise the code that painted exit stubs as the formulas being used to work
out the inner and outer points on the line were wrong - and as they were
dependent on the room size the stubs changed as the room size did. Since
we may now be painting a door marker on them it is easier if the length is
constant and does not depend on the room size.

Since we are now able to show door markings on custom exit lines (including
on special exits) and stub exits the tool-tips in the room exits control
panel is updated to now reflect this.

This will close Mudlet#499 and close Mudlet#668 and address an issue that Fuligin
raised in the Discord # help channel on 2021/01/08 .

BugFix -  revise handling of area exits with doors:

This actually doubles the amount that area exits stick out from the
starting room and revises the drawing code so that it is not so dependent
on the room size (which modified the `exitWidth` local that the code was
using). The particular detail that required this commit was that the way
that the underlying line was drawn that was used to derive the door symbol
from had the start and end points the opposite way around to that which I
had developed the code for!

Whilst cleaning things up I spotted that there was a redundant conversion
from a `QPointF` to a `QPoint` and then back to a `QPointF` when handling
the area exit click location - that is used to record when an area exit is
(double) clicked upon to initiate a speedwalk to the room in the adjacent
area.

Revised - provide "pair of doors" representation for doors on 2D Map

As requested during review.

Revised -  tweak some aspects of the door markings

Make them a bit (150%) thicker and a little longer.

Revised - use QLineF/QPointF instead of QLine/QPoint to pacify clang-tidy Bot

It seemed to be unhappy about "narrowing conversions" of `double`s to
`int`s. when a local line and point with integer coordinates are created
- and which are then used to create others which have floating point
values.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
SlySven added a commit to SlySven/Mudlet that referenced this pull request Feb 5, 2022
I conceived of this without being aware that the change in part of Mudlet#4608
that stopped drawing the entire exit line between two rooms both visible in
the mapper twice (once for each room) had been reverted by Mudlet#5949.

This is a suggested alternative that goes back to drawing the half a line
from each room towards the other room but additionally draws the other
section stating as fully opaque but fading to transparent at the far room.
If both rooms are visible this will be hidden by the corresponding fully
visible exit line from the other room - but not if not.

It is a bit more complex to do than might be first thought because the
`QPainter::drawLine(...)` methods only use the `QPainter`'s pen (otherwise
used to draw the outline of a shape) and a gradient shading effect only
applies to the brush (fill) of a shape. This means that the line has to be
constructed as a rectangle - and to draw it at an angle it needs to be done
with `QPainter::drawPolyon(...)` using a `QLinearGradient` as the brush and
no pen.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
SlySven added a commit to SlySven/Mudlet that referenced this pull request Feb 6, 2022
This is to allow existing map files that were not laid out to accommodate
them to still use the previous smaller ones.

The large arrows came about as a side effect of my adding door markings to
more exits (and stubs) in Mudlet#4608.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
vadi2 added a commit that referenced this pull request Feb 8, 2022
* Fix: allow the large 2D map area exit arrows to be reverted

This is to allow existing map files that were not laid out to accommodate
them to still use the previous smaller ones.

The large arrows came about as a side effect of my adding door markings to
more exits (and stubs) in #4608.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* Revise: fix spelling mistake

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

* Revise: adopt peer-review suggestions

Small arrows are now the default. The user will have to ask to use the
large ones - which means that existing maps should not have an issue with
the area exit arrows now - unlike as has been reported for the 4.15.0
release version.

A scaling factor used with different values for small and large area exit
arrows has been changed to be only generated once per call to
`(void) T2DMap::paintRoomExits(...)` instead of once or twice depending on
the direction of the exit in the XY-plane.

A tooltip for this *knob* has been removed as it specifically mentioned the
version of Mudlet that introduced the large area exits - and it doesn't
need to now the default is pretty much as Mudlet would have been before
that version.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>

Co-authored-by: Vadim Peretokin <vperetokin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doors aren't drawn on custom exit lines Doors are drawn over exits inconsistently

7 participants