Option for projectile ammo to match item instead of age (#2453)

* Projectile ammo matches ItemAction instead of age

extracted logic from months-old PR

* Added cvar under "Enhancements -> Gameplay -> Items" for bow/slingshot ammo

* Update GameMenuBar.cpp
This commit is contained in:
Cardboy777 2023-02-14 21:14:20 -05:00 committed by GitHub
commit 218971c4a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -2182,7 +2182,11 @@ void func_80834298(Player* this, PlayState* play) {
// Determine projectile type for bow or slingshot
s32 func_80834380(PlayState* play, Player* this, s32* itemPtr, s32* typePtr) {
if (LINK_IS_ADULT) {
bool useBow = LINK_IS_ADULT;
if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){
useBow = this->heldItemAction != PLAYER_IA_SLINGSHOT;
}
if (useBow) {
*itemPtr = ITEM_BOW;
if (this->stateFlags1 & PLAYER_STATE1_23) {
*typePtr = ARROW_NORMAL_HORSE;
@ -11450,7 +11454,12 @@ s32 func_8084B3CC(PlayState* play, Player* this) {
func_80835C58(play, this, func_8084FA54, 0);
if (!func_8002DD6C(this) || Player_HoldsHookshot(this)) {
func_80835F44(play, this, 3);
s32 projectileItemToUse = ITEM_BOW;
if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){
projectileItemToUse = LINK_IS_ADULT ? ITEM_BOW : ITEM_SLINGSHOT;
}
func_80835F44(play, this, projectileItemToUse);
}
this->stateFlags1 |= PLAYER_STATE1_20;