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

Add widgets for movement mode, bodypart status, weather, and vehicle #53874

Closed
wants to merge 18 commits into from

Conversation

wapcaplet
Copy link
Contributor

@wapcaplet wapcaplet commented Dec 29, 2021

Summary

Features "Add widgets for movement mode, bodypart status, weather, and vehicle"

Purpose of change

To flesh out some important remaining widgets, building on #44683

Describe the solution

Add widget variables, JSON definitions, and supporting functions for:

  • Movement mode letter (W, R, C, P) and full word (walking, running, crouching, prone)
  • Vehicle azimuth (direction in degrees), current/target speed, and percent of fuel remaining
  • Weather description (Sunny, Cloudy, Drizzle, Portal Storm etc.)
  • Body part status (bitten, bleeding, infected)

Add more widget test cases to cover these and existing stuff.

Describe alternatives you've considered

There is no way but forward

Testing

tests/cata_test '[widget]'

Additional context

Some in-progress screenshots of sidebar using the new widgets:

image

image

Driving around with plenty of gas:

image

Reckless acceleration beyond safe speed:

image

Backing up:

image

Low on gas:

image

New bodypart status text/color indicators (with classic color-coded health bars beneath):

image

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Dec 29, 2021
@wapcaplet wapcaplet added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Info / User Interface Game - player communication, menus, etc. labels Dec 29, 2021
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 29, 2021
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 30, 2021
@PatrikLundell
Copy link
Contributor

I don't understand the point of doubling up on movement mode in the screenshots. If there is a point to showing the movement letter (I fail to see it, but there probably is one), it could be crammed in front of the full name "(R) running", "(W) walking", "(C) crouching", "(P) prone". This format would still use less horizontal space than e.g. "Portal Storm", so there shouldn't be an issue of insufficient room for it.

@wapcaplet
Copy link
Contributor Author

I don't understand the point of doubling up on movement mode in the screenshots. If there is a point to showing the movement letter (I fail to see it, but there probably is one), it could be crammed in front of the full name "(R) running", "(W) walking", "(C) crouching", "(P) prone". This format would still use less horizontal space than e.g. "Portal Storm", so there shouldn't be an issue of insufficient room for it.

The screenshots with both "R" and "running" shown are demonstrating examples of two different widget variables for indicating movement mode, move_mode_letter and move_mode_text. I wanted to show what both of them look like together, so I put them into the same layout as two rows:

{
  "//": "...",
  "style": "layout",
  "arrange": "rows",
  "widgets": [ "move_mode_letter", "move_mode_desc" ]
}

image

image

Before this PR, the only indicator fo movement mode was the single-letter version (and it was hard-coded into the sidebar locations where it appeared). But because a red "R" by itself is not very informative without context, I added another widget variable to show the full word, which you can add to your own sidebar if you want it.

Now, you the player have the option of which version you want to see (or both, or neither), and where in your sidebar you want it to appear.

@wapcaplet wapcaplet changed the title Add widgets for movement mode, weather, and vehicle Add widgets for movement mode, bodypart status, weather, and vehicle Dec 30, 2021
@wapcaplet wapcaplet marked this pull request as ready for review December 31, 2021 21:12
@wapcaplet wapcaplet marked this pull request as draft December 31, 2021 21:54
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 1, 2022
@github-actions github-actions bot added BasicBuildPassed This PR builds correctly, label assigned by github actions and removed BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jan 1, 2022
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 1, 2022
src/move_mode.cpp Outdated Show resolved Hide resolved
src/panels.cpp Outdated Show resolved Hide resolved
- New move_mode::type_name - full name of mode ("walking", "running")
- New display::move_mode_text_color - full name ("walking", "running")
- Existing function moved to display::move_mode_letter_color ("W", "R")
- New widget_vars: move_mode_letter, move_mode_text
- New widget JSON: move_mode_letter, move_mode_desc
- Test cases

TODO:
- Rename "desc" to "text"

Return ERROR for invalid movement mode type_name
- New display::weather_text_color - current weather conditions, in color
- New weather_text widget_var - showing weather_text_color
- New weather_desc widget

TODO:
- Rename "desc" to "text"
- Add display::vehicle_cruise_text_color

TODO:
- Merge with widget changes
- Add tests
Indicates bitten, bleeding, and/or infected status by comma-separated
list of words, with colorization by limb_color.

- New display::bodypart_status - bitten, bleeding, and/or infected
- New display::bodypart_status_text_color - colorized status for part
- New bp_status_text widget_var - showing bodypart_status_text_color
- New widget declarations in sidebar.json
- Test cases

TODO:
- Fold limb_color refactor into this
- Remove "top" and "bottom" layouts, replace with more useful layout
Calling set_nextweather refreshes current weather, so overridden weather
and windspeed can take effect immediately.
Due to tidy warning/error about too-complex function
@wapcaplet
Copy link
Contributor Author

This PR is getting pretty chonky. I will probably peel off a few of the major standalone parts as separate PRs for easier review.

@wapcaplet
Copy link
Contributor Author

Closing this PR in lieu of these four separate PRs: #53975, #53976, #53977, #53978 - between them, these include everything from this one.

@wapcaplet wapcaplet closed this Jan 2, 2022
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` 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants