Rocs Feather - LetItSnow Edition - No Save Edition - Limited Edition (#4577)

* Rocs Feather Take 2

* Tooltip
This commit is contained in:
aMannus 2024-11-24 15:18:01 +01:00 committed by GitHub
parent f1dc432589
commit 7d3b9e8211
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 84 additions and 2 deletions

View File

@ -2461,6 +2461,9 @@ s32 Ship_CalcShouldDrawAndUpdate(PlayState* play, Actor* actor, Vec3f* projected
void PauseWarp_HandleSelection();
void PauseWarp_Execute();
// Exposing for Roc's Feather
void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* play, u16 sfxId);
// #endregion
#ifdef __cplusplus

View File

@ -0,0 +1,76 @@
#include "Holiday.hpp"
#define AUTHOR "aMannus"
#define CVAR(v) "gHoliday." AUTHOR "." v
extern "C" {
#include <z64.h>;
#include "functions.h";
#include "variables.h";
#include "macros.h";
#include "objects/gameplay_keep/gameplay_keep.h"
extern PlayState* gPlayState;
}
uint8_t rocsUseCount = 0;
static void ConfigurationChanged() {
COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("RocsFeather"), 0), []() {
Player* player = GET_PLAYER(gPlayState);
// Reset Rocs count when touching the ground
if (player->actor.bgCheckFlags & 1) {
rocsUseCount = 0;
}
});
COND_VB_SHOULD(VB_USE_ITEM, CVarGetInteger(CVAR("RocsFeather"), 0), {
int32_t* usedItem = va_arg(args, int32_t*);
Player* player = GET_PLAYER(gPlayState);
// Roc's Feather behaviour
if (*usedItem == ITEM_NAYRUS_LOVE) {
*should = false;
if (!rocsUseCount) {
rocsUseCount++;
player->linearVelocity = 5.0f;
player->actor.velocity.y = 8.0f;
player->actor.world.rot.y = player->yaw = player->actor.shape.rot.y;
func_80838940(player, (LinkAnimationHeader*)&gPlayerAnim_link_fighter_backturn_jump,
!(2 & 1) ? 5.8f : 3.5f, gPlayState, 0);
Vec3f effectsPos = player->actor.home.pos;
effectsPos.y += 3;
f32 effectsScale = 1;
if (!gSaveContext.linkAge) {
effectsScale = 1.5f;
}
EffectSsGRipple_Spawn(gPlayState, &effectsPos, 200 * effectsScale, 300 * effectsScale, 1);
EffectSsGSplash_Spawn(gPlayState, &effectsPos, NULL, NULL, 0, 150 * effectsScale);
player->stateFlags2 &= ~(PLAYER_STATE2_HOPPING);
Player_PlaySfx(&player->actor, NA_SE_PL_SKIP);
}
}
});
}
static void DrawMenu() {
ImGui::SeparatorText(AUTHOR);
if (UIWidgets::EnhancementCheckbox("Roc's Feather", CVAR("RocsFeather"))) {
ConfigurationChanged();
}
UIWidgets::Tooltip("Using Nayru's Love will now act as Roc's Feather instead! No magic required.");
}
static void RegisterMod() {
// #region Leave this alone unless you know what you are doing
ConfigurationChanged();
// #endregion
}
static Holiday holiday(DrawMenu, RegisterMod);

View File

@ -344,6 +344,7 @@ typedef enum {
VB_PLAY_THROW_ANIMATION,
VB_INFLICT_VOID_DAMAGE,
VB_GANONDORF_DECIDE_TO_FIGHT,
VB_USE_ITEM,
/*** Give Items ***/

View File

@ -2572,11 +2572,13 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) {
sHeldItemButtonIsHeldDown = true;
}
} else {
if (GameInteractor_Should(VB_USE_ITEM, true, &item)) {
this->heldItemButton = i;
Player_UseItem(play, this, item);
}
}
}
}
void Player_StartChangingHeldItem(Player* this, PlayState* play) {
LinkAnimationHeader* anim;