Proper fix for 2 handed idle animation (#6109)

This commit is contained in:
Garrett Cox
2026-01-08 12:20:16 -06:00
committed by GitHub
parent d62e8108fd
commit 8584ced40b
3 changed files with 88 additions and 7 deletions
@@ -8293,19 +8293,20 @@ void Player_ChooseNextIdleAnim(PlayState* play, Player* this) {
//
// Note that `FIDGET_SWORD_SWING` is the first common fidget type, which is why
// all operations are done relative to this type.
if (((commonType + FIDGET_SWORD_SWING != FIDGET_SWORD_SWING) &&
(commonType + FIDGET_SWORD_SWING != FIDGET_ADJUST_SHIELD)) ||
((this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) &&
((commonType + FIDGET_SWORD_SWING == FIDGET_ADJUST_SHIELD) ||
(Player_GetMeleeWeaponHeld2(this) != 0)))) {
if (GameInteractor_Should(VB_SET_IDLE_ANIM,
(((commonType + FIDGET_SWORD_SWING != FIDGET_SWORD_SWING) &&
(commonType + FIDGET_SWORD_SWING != FIDGET_ADJUST_SHIELD)) ||
((this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) &&
((commonType + FIDGET_SWORD_SWING == FIDGET_ADJUST_SHIELD) ||
(Player_GetMeleeWeaponHeld2(this) != 0)))),
this, commonType)) {
//! @bug It is possible for `FIDGET_ADJUST_SHIELD` to be used even if
//! a shield is not currently equipped. This is because of how being shieldless
//! is implemented. There is no sword-only model type, only
//! `PLAYER_MODELGROUP_SWORD_AND_SHIELD` exists. Therefore, the right hand type will be
//! `PLAYER_MODELTYPE_RH_SHIELD` if sword is in hand, even if no shield is equipped.
if ((commonType + FIDGET_SWORD_SWING == FIDGET_SWORD_SWING) &&
Player_HoldsTwoHandedWeapon(this) &&
CVarGetInteger(CVAR_ENHANCEMENT("TwoHandedIdle"), 0) == 1) {
Player_HoldsTwoHandedWeapon(this)) {
//! @bug This code is unreachable.
//! The check above groups the `Player_GetMeleeWeaponHeld2` check and
//! `PLAYER_MODELTYPE_RH_SHIELD` conditions together, meaning sword and shield must be