Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate NPC rules to a new, dedicated imgui menu #74359

Closed
wants to merge 7 commits into from

Conversation

RenechCDDA
Copy link
Member

@RenechCDDA RenechCDDA commented Jun 7, 2024

Summary

Interface "NPC follower rules can now be viewed and modified in a dedicated, mouse-supported window (imgui)"

Purpose of change

Everyone agrees the dialogue menu does its job for this, but it could be so much better...

Describe the solution

Make it better, and with making it better comes mouse support!

There is now a dedicated top-level talk topic which opens this new imgui window, no need to remember which of the sub-menus your specific rule was in. Each rule can be fully adjusted with a dedicated hotkey or mouse-sensitive buttons. For rules with multiple states (e.g. CBM recharge %) keyboard presses of the hotkey will cycle to the next setting, while mouse presses are set directly to the selected % button. Keyboard users also have the option of navigating(standard up/down/left/right inputs) directly to the desired setting and press enter, instantly setting that value without a need to toggle through the proceeding ones.

(Still WIP) Tie the imgui buttons to a specific set of auto-assigned hotkeys, like our dialogue does. This is almost certainly a requirement before this PR can be undrafted.

Describe alternatives you've considered

Testing

2024-06-08.09-05-26.mp4

Additional context

In the interests of encouraging reviews, I have added a hopefully funny easter egg somewhere in this PR. It will only appear in game with a 0.1% chance.

@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. astyled astyled PR, label is assigned by github actions labels Jun 7, 2024
@RenechCDDA RenechCDDA force-pushed the follower_rules_UI branch from 6109f4e to 56e356a Compare June 7, 2024 02:16
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jun 7, 2024
@Kamejeir
Copy link
Contributor

Kamejeir commented Jun 7, 2024

clicking the x on the menu makes it unresponsive until re-opened (also no indication to hit esc or space for closing it, in general)

@RenechCDDA
Copy link
Member Author

clicking the x on the menu makes it unresponsive until re-opened (also no indication to hit esc or space for closing it, in general)

I am aware, thank you.

@RenechCDDA
Copy link
Member Author

"Hm I don't know how to solve this, how did I do it on the mission UI?"

the mission UI doesn't close when you press the close button either

THANKS ME

@github-actions github-actions bot added the Missions Quests and missions label Jun 7, 2024
@RenechCDDA RenechCDDA marked this pull request as ready for review June 7, 2024 18:23
@RenechCDDA
Copy link
Member Author

I'm marking this ready for review, because that's what it is: Ready for review.

I am reasonably confident in it, though I may still push more commits. There was a reasonable request to switching from using "CHANGE" buttons to checkboxes. There's also some boilerplate which could stand to be templated.

@RenechCDDA RenechCDDA force-pushed the follower_rules_UI branch from 3933854 to e24480b Compare June 8, 2024 11:03
@github-actions github-actions bot added the Code: Tests Measurement, self-control, statistics, balancing. label Jun 8, 2024
…by pressing close button.

Also fixed this in mission ui
@RenechCDDA RenechCDDA force-pushed the follower_rules_UI branch from e24480b to 2fd22db Compare June 8, 2024 12:52
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 8, 2024
@RenechCDDA RenechCDDA force-pushed the follower_rules_UI branch from 2fd22db to 97a3aa1 Compare June 8, 2024 13:02
@RenechCDDA
Copy link
Member Author

I'm marking this ready for review, because that's what it is: Ready for review.

I am reasonably confident in it, though I may still push more commits. There was a reasonable request to switching from using "CHANGE" buttons to checkboxes. There's also some boilerplate which could stand to be templated.

Instead of checkboxes, we got colored buttons. (Checkboxes could still be added later, but colorizing the buttons keeps it consistent and means I don't have to do anything else!)

Template was implemented to keep nice and streamlined.

The only thing I could want now is a confirmation on defaulting all settings. I was using query_yn for this, but it causes a crash(see code comments).

Assuming tests pass, we are good to go.

src/npctalk_rules.cpp Show resolved Hide resolved
src/npctalk_rules.cpp Outdated Show resolved Hide resolved
src/npctalk_rules.h Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 9, 2024
@RenechCDDA RenechCDDA force-pushed the follower_rules_UI branch from 9f71e54 to 6e43d5a Compare June 9, 2024 00:17
src/npctalk_rules.h Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the astyled astyled PR, label is assigned by github actions label Jun 9, 2024
@RenechCDDA RenechCDDA force-pushed the follower_rules_UI branch from a1afc7e to 567b509 Compare June 9, 2024 07:40
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 9, 2024
@RenechCDDA RenechCDDA force-pushed the follower_rules_UI branch from aa3ea01 to e5c7dd0 Compare June 9, 2024 20:40
Copy link
Contributor

@db48x db48x left a comment

Choose a reason for hiding this comment

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

I think that the boolean options should be checkboxes, and the multiple–choice ones should be list boxes or combo boxes.

src/npctalk_rules.cpp Outdated Show resolved Hide resolved
src/npctalk_rules.cpp Outdated Show resolved Hide resolved
src/mission_ui.cpp Show resolved Hide resolved
Copy link
Contributor

@db48x db48x left a comment

Choose a reason for hiding this comment

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

And the same for all the other repetitions of the same pattern in the rest of the code.

src/npctalk_rules.cpp Outdated Show resolved Hide resolved
@db48x
Copy link
Contributor

db48x commented Jun 11, 2024

Another thing, the import/export dialog is really confusing if you only have one NPC, because the table is empty.

@RenechCDDA
Copy link
Member Author

Another thing, the import/export dialog is really confusing if you only have one NPC, because the table is empty.

...Is it? It ends up being an empty table, which makes sense to me.

@db48x
Copy link
Contributor

db48x commented Jun 12, 2024

Normally one exports things to a file, so it made no sense until I went back and read the source code. Maybe the wording should be changed, and perhaps there should be some acknowledgement that you haven’t got any other NPCs to make it more clear that you should return to this window later.

src/npctalk_rules.cpp Outdated Show resolved Hide resolved
-Extract the common button setup into a function
-Only pop style color when it's been pushed
-Export/Import displays warning when only 1 follower
-other very minor changes
@RenechCDDA
Copy link
Member Author

Normally one exports things to a file, so it made no sense until I went back and read the source code. Maybe the wording should be changed, and perhaps there should be some acknowledgement that you haven’t got any other NPCs to make it more clear that you should return to this window later.

OK, done
image

@db48x
Copy link
Contributor

db48x commented Jun 12, 2024

Yea, that works. I think it would also be better to avoid the terms “import” and “export”. Perhaps “copy” instead? Also, is there really a need for two buttons as well as a toggle inside the transfer window itself? I think that a single button labeled “Copy rules to/from other followers” would suffice.

src/npctalk_rules.cpp Show resolved Hide resolved
@db48x
Copy link
Contributor

db48x commented Jun 12, 2024

Checkboxes and radio buttons were not that hard to do:

Screenshot from 2024-06-12 14-42-47

Want me to send you a pull request?

@Brambor
Copy link
Contributor

Brambor commented Jun 12, 2024

Not for this issue to solve, but:
image

@RenechCDDA
Copy link
Member Author

RenechCDDA commented Jun 15, 2024

Want me to send you a pull request?

(tl;dr: yes send PR thank you!)

I don't think it'd be wrong, I just... prefer? the colored buttons. Basically,

-I like the colored buttons. (100% subjective opinion)

-The colored buttons offers a more CDDA-style look (again, 100% subjective opinion)

-I do not think checkboxes would convey what is happening in the import/export screen, which means regardless the button implementation stays there.
--If the buttons stay there, it clashes with this part of the rules screen which would subsequently use checkboxes.

Points in favor of checkboxes:
-Checkboxes offer better accessibility, guaranteeing that any flavor of colorblindness or visual impairment can use them.

-Your checkbox implementation looks pretty sexy

-If you already have the branch, any cost of switching to it has already been paid

So if it's not any trouble to you, please send the PR . Or PR directly to cleverraven if/after this one is merged, if that would be easier for you.

Not for this issue to solve, but:

It previously used <mypronoun> which resulted in will attack anything She wants. (notice the capitalization)

I was trying to keep the strings as close to the old ones as possible, but might be worth kicking that one to something different.

@db48x
Copy link
Contributor

db48x commented Jun 15, 2024

Did you by any chance change your github preferences so that you don’t get pull requests in your fork? It doesn’t give me the option of sending you one.

You could also just pull from my branch and push it to yours, if that’s easier than mucking about with github.

@RenechCDDA
Copy link
Member Author

I don't believe I've made any changes, and just recently got the first and only PR to my fork.

But sure, you can just link the branch. I can merge, cherry pick, etc as appropriate

@db48x
Copy link
Contributor

db48x commented Jun 15, 2024

@db48x
Copy link
Contributor

db48x commented Jun 19, 2024

BTW, I did manage to make a PR the other day: RenechCDDA#2

@IoIqq
Copy link

IoIqq commented Jun 28, 2024

This looks really cool!

@Maleclypse
Copy link
Member

There’s conflicts to resolve if this is ready for merge?

@RenechCDDA
Copy link
Member Author

I need to rebase it (to keep the commit history clean-ish) and then check out db48x's branch, I just haven't gotten around to it despite constantly expecting to

@db48x
Copy link
Contributor

db48x commented Jun 30, 2024

I’m not busy today so I’ll go ahead and rebase for you. I’ll end up with a new PR though.

@RenechCDDA
Copy link
Member Author

I’m not busy today so I’ll go ahead and rebase for you. I’ll end up with a new PR though.

Well I guess that WOULD let me work on something else...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Missions Quests and missions NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants