Skip to content

Fixes Goron Wakeup animations#897

Merged
Kenix3 merged 3 commits intoHarbourMasters:develop-rachaelfrom
leggettc18:goron-no-speen
Jul 25, 2022
Merged

Fixes Goron Wakeup animations#897
Kenix3 merged 3 commits intoHarbourMasters:develop-rachaelfrom
leggettc18:goron-no-speen

Conversation

@leggettc18
Copy link
Contributor

@leggettc18 leggettc18 commented Jul 23, 2022

Fixes #80

This fixes the Gorons' Wake Up animations so that they no longer spin when waking up. It seems to be related somehow to the morphFrames being set to -8.0f on those animations. Changing them to 0.0f on the relevant animations causes the spin to not happen. Additionally, Biggoron has a glitchy frame at the start of his animation still, so I set the startFrame to 1.0f on his and it looks pretty smooth. In order to preserve the spinny Goron behavior (since people seemed to like it) I added two new animations which are copies of the original ones with the fixes applied, and conditionally switch between them with a CVar named "gGoronSpeen" (can rename to gGoronSpin if the silliness is not appreciated). 0 is the default fixed behavior, while 1 is the old behavior. This CVar is not exposed in the UI, so you would have to edit your shipofharkinian.json for it

2022-07-22.21-15-27.mp4

@Kenix3
Copy link
Collaborator

Kenix3 commented Jul 23, 2022

My guess is that what actually happens is that the static animation table is not reset when all actors are reloaded. We use reset functions to reset static actor data. It may be best to try to fix it there. Further, the cvar could wrap the code in reset to apply the spin.

@leggettc18
Copy link
Contributor Author

I'll try to take a look into that, but I don't think the data that seems to be responsible for the spin is static. The morphFrames I mentioned actually get applied to calculations to a particular actor's skelAnime->morphRate and morphWeight further down the line. I could have also constantly reset those to 0 during some of the action functions, but that came off messier than the fix I supplied here.

I'll see about resetting some of these values in the reset function and see if that does anything.

@leggettc18
Copy link
Contributor Author

Yeah I'm not seeing any static info I can reset in the Goron's actor in order to prevent this spin from happening. It's gotta be something about the morphFrames, and I'm pretty sure they've been spinning since the very beginning, even before we implemented matrix interpolation. This is the only fix I'm aware of.

/* 12 */ ENGO2_ANIM_12
/* 12 */ ENGO2_ANIM_12,
/* 13 */ ENGO2_ANIM_13, // Fixed Goron Wakeup Animation
/* 14 */ ENGO2_ANIM_14 //Fixed Biggoron Wakeup Animation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing after the // in the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this in the most recent commit.

if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) {
OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ((CVar_GetS32("gGoronSpeen", 0) == 1) ? ENGO2_ANIM_10 : ENGO2_ANIM_14));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how useful it is to keep a cvar that's not publicly exposed. While I guess some few people might want to keep this, it'll make cleanups of unused cvars harder in the future if some are "unused" on purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I intended it as more of an "Easter Egg" that could be enabled since people seemed to like the spinning Gorons. Since it would only be enabled for some silly fun, I was thinking later we find some semi-obscure way to expose it, like a junk hint in Rando or some kind of splash screen message. I could add a checkbox to the cheats menu if you think that would be better?

@Kenix3
Copy link
Collaborator

Kenix3 commented Jul 24, 2022

Yeah I'm not seeing any static info I can reset in the Goron's actor in order to prevent this spin from happening. It's gotta be something about the morphFrames, and I'm pretty sure they've been spinning since the very beginning, even before we implemented matrix interpolation. This is the only fix I'm aware of.

Static data reset would have nothing to do with frame interpolation. :)

So in the authentic game, actor code was loaded similar to how a dll is loaded in modern programs. They'd be unloaded when all actors are removed. This loading and unloading of code would clear anything in the .data section of the overlay code.

Since Ship does not use actor overlays, the static data is by default not reset and never has been.

@leggettc18
Copy link
Contributor Author

Oh I thought I remembered your first comment mentioning something about interpolation so that's why I was confused, so we're on the same page about this having nothing to do with interpolation. Must've gotten my wires crossed.

By resetting static data, you're referring to something similar to what I did in #639 right? Or something else? If the latter could you point me in the right direction on where this data reset needs to occur? If it's the former there is no static data in the Goron actor that I can reset that has any effect on the spin. Believe me I've tried.

@Kenix3
Copy link
Collaborator

Kenix3 commented Jul 24, 2022

Yeah, it'd be the same thing. I don't see the anim array getting changed in the code, though, so it's unlikely to be static data reset problem.

In the initial PR you mention something is errantly set to -8.0f. What is that, and can you determine why?

@leggettc18
Copy link
Contributor Author

It's just what's in the code in the sAnimationInfo array declaration in z_en_go2.c. I'm not sure if it's exactly "errant" or if it's something that just behaves differently on N64 due to some quirk, but it's the morphFrames attribute of the AnimationInfo struct in some of the elements of that array. These values are the same in decomp that they are in our codebase currently, without this PR, which is why I wouldn't say they are errant, just causing an issue on our end. I should probably try to build a decomp rom at some point and verify that it isn't an issue there but I doubt it is.

For the first video I posted in Discord I had changed the basic Goron Wake Up animation to the 0 index of that array instead of 1, but I later realized that the only difference between those two AnimationInfo entries was the morphFrames, where the 0 index had 0.0f for the morph frames and the 1 index had -8.0f. They both referenced the same AnimationHeader (and so does Biggoron with index 10 of that array). So I created two new AnimationInfo entries for the fixed morphFrame versions. One for basic Gorons, and one for Biggoron. Biggoron's animation was also referencing the same AnimationHeader but had a different value applied for it's mode attribute to enable interpolation, since his animation plays slower and would look choppy without it. Additionally, Biggoron had one frame where he seemed to "disappear" and pop back in when the morphFrames were set to 0.0f, so I set the startFrame to 1.0f to sort of skip that frame. I could probably re-use the 0 index animation for basic Gorons instead of creating a new one, it just seemed right to create a new one in the spirit of keeping our changes separate from the base decomp project wherever possible.

Maybe there's something waaaaay deeper in the code we could change but every other animation in the game I'm aware of plays fine as is, so changing anything there would require a lot of testing.

@Kenix3 Kenix3 merged commit 87ed5fe into HarbourMasters:develop-rachael Jul 25, 2022
Kenix3 pushed a commit to Kenix3/Shipwright that referenced this pull request Oct 19, 2022
* Fixes Goron Wakeup animations

* Cleanup of some unneeded code.

* Fixes comment spacing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants