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
parent 462ab00c7e
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

@ -403,6 +403,8 @@ namespace GameMenuBar {
UIWidgets::Tooltip("Makes nuts explode bombs, similar to how they interact with bombchus. This does not affect bombflowers.");
UIWidgets::PaddedEnhancementCheckbox("Equip Multiple Arrows at Once", "gSeparateArrows", true, false);
UIWidgets::Tooltip("Allow the bow and magic arrows to be equipped at the same time on different slots");
UIWidgets::PaddedEnhancementCheckbox("Bow as Child/Slingshot as Adult", "gBowSlingShotAmmoFix", true, false);
UIWidgets::Tooltip("Allows child to use bow with arrows.\nAllows adult to use slingshot with seeds.\n\nRequires glitches or 'Timeless Equipment' cheat to equip.");
UIWidgets::PaddedEnhancementCheckbox("Better Farore's Wind", "gBetterFW", true, false);
UIWidgets::Tooltip("Helps FW persist between ages, gives child and adult separate FW points, and can be used in more places.");
UIWidgets::PaddedEnhancementCheckbox("Static Explosion Radius", "gStaticExplosionRadius", true, false);

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;