-
-
Notifications
You must be signed in to change notification settings - Fork 465
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
[CoC] Add HUD animation speed parameter support in ltx files. #1763
[CoC] Add HUD animation speed parameter support in ltx files. #1763
Conversation
} | ||
else | ||
{ | ||
R_ASSERT2(_GetItemCount(anm.c_str()) == 2, anm.c_str()); | ||
R_ASSERT2(_GetItemCount(anm.c_str()) <= 3, anm.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code below requires at least one parameter, and uses additional two.
It's more logical to use this condition:
R_ASSERT2(_GetItemCount(anm.c_str()) <= 3, anm.c_str()); | |
R_ASSERT2(_GetItemCount(anm.c_str()) > 0, anm.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logics before:
1 parameter - use name as base and additional parameter
2+ parameters - assert it is only 2 params and read both
Logics after:
1 parameter - same as before
2+ parameters - make sure it is either 2 or 3 parameters, if someone leaves empty space and wants to only add animation speed
Seems like:
1 - adding < 0 assertion and storing count as variant makes sense
2 - probably I should add trimming for pm.m_additional_name strlen check? Or parser of comma separated values already does it? Will need to check it
@@ -414,8 +418,6 @@ void attachable_hud_item::reload_measures() | |||
|
|||
u32 attachable_hud_item::anim_play(const shared_str& anm_name_b, BOOL bMixIn, const CMotionDef*& md, u8& rnd_idx) | |||
{ | |||
const float speed = CalcMotionSpeed(anm_name_b); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse this somehow? We still support multiplayer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This util used for two different classes. Can add one more param to use as base and keep it pure function or copy-paste as separate methods/util functions. Sounds like first variant is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated util / excluded non-singleplayer games from animation speed calculations.
803f745
to
ba4277f
Compare
ba4277f
to
ebb3ee7
Compare
Still testing it while integrating some weapons from CoC/anomaly. Without it game crashes on assertions / has de-synced sounds.
Changes
Examples
Links
https://github.com/revolucas/CoC-Xray/blob/551dfba681928b7a1292949cb2156c24174d96d6/src/xrGame/player_hud.cpp#L77
https://github.com/revolucas/CoC-Xray/blob/551dfba681928b7a1292949cb2156c24174d96d6/src/xrGame/player_hud.cpp#L352