Repository navigation
add configuration options for rocs feather #7466
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
base: develop
Are you sure you want to change the base?
Changes from all commits
9df6820
7d1dbd7
461e5e4
9dee245
cfcb121
b3bc605
08dc991
f85adb6
d649aff
a0bf40d
f196f11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| #include <libultraship/bridge/consolevariablebridge.h> | ||
|
|
||
| #include "soh/Enhancements/game-interactor/GameInteractor.h" | ||
| #include "soh/Enhancements/randomizer/SeedContext.h" | ||
| #include "soh/ShipInit.hpp" | ||
|
|
||
| extern "C" { | ||
|
|
@@ -8,19 +11,67 @@ extern "C" { | |
| #include "variables.h" | ||
| #include "macros.h" | ||
| extern PlayState* gPlayState; | ||
| extern SaveContext gSaveContext; | ||
| } | ||
|
|
||
| #define MAX_ROCS_USES 1 | ||
|
|
||
| static uint8_t rocsUseCount = 0; | ||
| static uint8_t groundTimer = 0; | ||
| static f32 effectsScale = 1.0f; | ||
| static bool rocsConsumable = true; | ||
|
|
||
| static u8& RocsFeathersAcquired() { | ||
| return gSaveContext.ship.quest.data.randomizer.rocsFeathersAcquired; | ||
| } | ||
|
|
||
| static u8& RocsFeathersRemaining() { | ||
| return gSaveContext.ship.quest.data.randomizer.rocsFeathersRemaining; | ||
| } | ||
|
|
||
| void UseRocsFeather(PlayState* playState, Player* player) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to have a message builder here to keep a consistent experience with consumable Nayru's
This comment was marked as outdated.
Sorry, something went wrong. |
||
| if (RocsFeathersRemaining() > 0) { | ||
| RocsFeathersRemaining()--; | ||
|
|
||
| func_80838940(player, (LinkAnimationHeader*)&gPlayerAnim_link_rocs_feather_jump, 5.8f, playState, 0); | ||
|
|
||
| // Actionvar needed to prevent weird animation morph | ||
| player->av2.actionVar2 = 1; | ||
|
|
||
| // Move player forward on Roc's use | ||
| player->linearVelocity = 5.0f; | ||
| player->actor.world.rot.y = player->yaw = player->actor.shape.rot.y; | ||
|
|
||
| if (gSaveContext.linkAge == LINK_AGE_CHILD) { | ||
| player->actor.velocity.y = 7.0f; | ||
| effectsScale = 1.0f; | ||
| } else { | ||
| player->actor.velocity.y = 7.5f; | ||
| effectsScale = 1.5f; | ||
| } | ||
|
|
||
| Vec3f effectsPos = player->actor.home.pos; | ||
| effectsPos.y += 3; | ||
|
|
||
| EffectSsGRipple_Spawn(playState, &effectsPos, static_cast<s16>(200 * effectsScale), | ||
| static_cast<s16>(300 * effectsScale), 1); | ||
| EffectSsGSplash_Spawn(playState, &effectsPos, NULL, NULL, 0, static_cast<s16>(150 * effectsScale)); | ||
|
|
||
| // Remove hopping state when using Roc's after sidehop/backflip to allow grabbing ledges again | ||
| player->stateFlags2 &= ~(PLAYER_STATE2_HOPPING); | ||
|
|
||
| Player_PlaySfx(&player->actor, NA_SE_PL_SKIP); | ||
| } else { | ||
| Sfx_PlaySfxCentered(NA_SE_SY_ERROR); | ||
| } | ||
| } | ||
|
|
||
| void RegisterRocsFeather() { | ||
| // Always register hooks - they only activate when ITEM_ROCS_FEATHER is actually used | ||
| // Rando-specific logic (item pool, accessibility, etc.) is handled elsewhere | ||
| bool shouldRegister = true; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question for @serprex - I realize this is inherited but wondering if registration should at least be gated on
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but I think there was some effort made to allow enabling Roc's Feather in normal play using save editor. I don't think maintaining that is necessary if this can be made more elegant by not supporting that |
||
|
|
||
| COND_HOOK(OnLoadFile, shouldRegister, [](int32_t fileNum) { | ||
| rocsConsumable = Rando::Context::GetInstance()->GetOption(RSK_ROCS_FEATHER).Is(RO_ROCS_FEATHER_CONSUMABLE); | ||
| }); | ||
|
|
||
| COND_HOOK(OnPlayerUpdate, shouldRegister, []() { | ||
| Player* player = GET_PLAYER(gPlayState); | ||
|
|
||
|
|
@@ -33,8 +84,8 @@ void RegisterRocsFeather() { | |
| groundTimer = 0; | ||
| } | ||
|
|
||
| if (groundTimer >= 3) { | ||
| rocsUseCount = 0; | ||
| if (!rocsConsumable && groundTimer >= 3) { | ||
| RocsFeathersRemaining() = RocsFeathersAcquired(); | ||
| } | ||
| }); | ||
|
|
||
|
|
@@ -45,40 +96,9 @@ void RegisterRocsFeather() { | |
| if (usedItem == ITEM_ROCS_FEATHER) { | ||
| *should = false; | ||
|
|
||
| if (rocsUseCount < MAX_ROCS_USES) { | ||
| rocsUseCount++; | ||
|
|
||
| Player* player = GET_PLAYER(gPlayState); | ||
|
|
||
| func_80838940(player, (LinkAnimationHeader*)&gPlayerAnim_link_rocs_feather_jump, 5.8f, gPlayState, 0); | ||
| Player* player = GET_PLAYER(gPlayState); | ||
|
|
||
| // Actionvar needed to prevent weird animation morph | ||
| player->av2.actionVar2 = 1; | ||
|
|
||
| // Move player forward on Roc's use | ||
| player->linearVelocity = 5.0f; | ||
| player->actor.world.rot.y = player->yaw = player->actor.shape.rot.y; | ||
|
|
||
| if (gSaveContext.linkAge == LINK_AGE_CHILD) { | ||
| player->actor.velocity.y = 7.0f; | ||
| effectsScale = 1.0f; | ||
| } else { | ||
| player->actor.velocity.y = 7.5f; | ||
| effectsScale = 1.5f; | ||
| } | ||
|
|
||
| Vec3f effectsPos = player->actor.home.pos; | ||
| effectsPos.y += 3; | ||
|
|
||
| EffectSsGRipple_Spawn(gPlayState, &effectsPos, static_cast<s16>(200 * effectsScale), | ||
| static_cast<s16>(300 * effectsScale), 1); | ||
| EffectSsGSplash_Spawn(gPlayState, &effectsPos, NULL, NULL, 0, static_cast<s16>(150 * effectsScale)); | ||
|
|
||
| // Remove hopping state when using Roc's after sidehop/backflip to allow grabbing ledges again | ||
| player->stateFlags2 &= ~(PLAYER_STATE2_HOPPING); | ||
|
|
||
| Player_PlaySfx(&player->actor, NA_SE_PL_SKIP); | ||
| } | ||
| UseRocsFeather(gPlayState, player); | ||
| } | ||
| }); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.