Repository navigation
Walking Indicator - #1831
Walking Indicator#1831AdamTadeusz wants to merge 18 commits into
Conversation
… key pressed, remove unused variable
|
|
||
| ConVar cl_neo_hud_rangefinder_enabled("cl_neo_hud_rangefinder_enabled", "1", FCVAR_ARCHIVE, | ||
| "Show the rangefinder", true, 0.0f, true, 1.0f); | ||
| wchar_t m_wszRangeFinder[11]; |
There was a problem hiding this comment.
Nit: not technically a member (m_...) of the object instance, so perhaps this should be caps-case instead, for readability. Not that it really matters too much.
| C_NEO_Player* pTargetPlayer = pLocalPlayer->IsObserver() && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE) | ||
| ? static_cast<C_NEO_Player *>(pLocalPlayer->GetObserverTarget()) |
There was a problem hiding this comment.
Nit: If we ever add observer targets that are non-players (for example observing some kind of objective for a custom game mode like Jeff/Payload/etc, the static_cast<C_NEO_Player *>(pLocalPlayer->GetObserverTarget()) would be UB. I guess we'll hear from it if it happens but could be a place for some defensive if checks.
Perhaps grab a C_BaseEntity* instance first, then check ->IsPlayer, and if that passes, then we should be safe to static cast into C_NEO_Player* as long as it holds true that all players always are CNEOPlayers.
But I'm ok with merging this and fixing in the future if it breaks.
| static float animWalkKeyPressed = 0.f; | ||
| const bool isWalking = pPlayer->IsWalking(); | ||
| static float animIsMakingFootsteps = 0.f; | ||
| const bool isMakingFootsteps = pPlayer->IsMakingFootstepSounds() || !(pPlayer->GetFlags() & FL_ONGROUND); |
There was a problem hiding this comment.
Nit: for isMakingFootsteps value, maybe flip the || around to check the simpler FL_ONGROUND case first, so for the lucky case we don't need to call the more complex IsMakingFootstepSounds at all.
|
|
||
| CPanelAnimationVarAliasType(int, m_iXpos, "xpos", "r203", "proportional_xpos"); |
There was a problem hiding this comment.
Is the value supposed to be "203" instead of "r203" here, or is that a typo?
Grepping around we also do it at https://github.com/NeotokyoRebuild/neo/blame/5cb282a7a0ea123a2b571c01c22e6f953aa69eb0/src/game/client/neo/ui/neo_hud_ammo.h#L40 but I was too lazy to expand the macros and figure out where this is parsed
There was a problem hiding this comment.
specifying proportional_xpos uses CProportionalIntWithScreenspacePropertyX, and in ExtractValue ComputePos checks whether the first character is an alignment character. The default value here should follow the default value in HudLayout.res where I actually use c30 and c40, meaning 30 pixels to the right and 40 pixels down from the center of the screen on 640x480, but actually once I remove the entry the text is nowhere near the center, so there must be some difference in how the value in hudlayout.res is handled compared to the default in this constructor 🤔
There was a problem hiding this comment.
LGTM
Funny enough, the following is not a problem because it ended up getting fixed by #2264... But without a fix that takes into account weapon speed ratio, walking when you do not have a weapon (such as in the tutorial) on the branch at time of writing showed "NOT WALKING" with any movement. But rebasing this branch on top of the current master will resolve this issue.
walking-indicator-bug-not-no-wep.mp4
If anything, this shows that this feature would have been handy for testing, like with this scenario.
(Added some nits in case you want to look into them after a rebase, but I'm fine with future PRs considering those nits as well.)
| int notWalkingTextWidth = 0; | ||
| int textHeight = 0; |
There was a problem hiding this comment.
Nit: notWalkingTextWidth and textHeight are non-const file-scope globals, so they have external linkage. static (or making them members) would keep them private to this file. On the other hand, if that ever becomes a problem then the naming is more obvious within that future context.
|
|
||
| ConVar cl_neo_hud_rangefinder_enabled("cl_neo_hud_rangefinder_enabled", "1", FCVAR_ARCHIVE, | ||
| "Show the rangefinder", true, 0.0f, true, 1.0f); | ||
| wchar_t m_wszRangeFinder[11]; |
There was a problem hiding this comment.
Nit: The old wchar_t m_wszRangeFinder[11]; member in neo_hud_compass.h is unused now that the rangefinder lives here, so it could be removed. This file-scope buffer could also be static.
| "In fractional to the total screen height, the y-axis position of the rangefinder.", | ||
| true, 0.0f, true, 1.0f); | ||
|
|
||
| ConVar cl_neo_ghost_callout_compass_time("cl_neo_ghost_callout_compass_time", "10.0", FCVAR_CHEAT, |
There was a problem hiding this comment.
Nit: Seems like this couples the position of the range finder with the walking indicator, and also resets customized positions of the range finder with the disappearance of these convars. I suppose I'm fine with it because one can disable the walking indicator as a new feature that previously didn't exist and just weak the new hud config, but maybe a future refinement is to allow a player to customize these two elements differently. (on the other hand I see how text alignment can be hard and this could be a pain to align separately)
Description
NeoAssets PR
Adds a walking indicator with an optional bar that indicates how close the player is to breaching the threshold above which the player will make noise regardless (mostly for debugging but some players may choose to use it in game i guess).
Also adds a command to set bot skin, since I forgot to remove it xP
Toolchain