-
Notifications
You must be signed in to change notification settings - Fork 596
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
Document Surface Material #1447
Conversation
src/code/z_actor.c
Outdated
actor->sfx = 3; | ||
} else if (arg1 < 100) { | ||
actor->sfx = NA_SE_PL_WALK_CONCRETE - SFX_FLAG; | ||
actor->sfx = 2; | ||
} else { | ||
actor->sfx = NA_SE_PL_WALK_SAND - SFX_FLAG; | ||
actor->sfx = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on this change? This doesn't play a sfx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is confusing to explain, but these values are actually timer states that get fed as seq ioData into seq ioPort, that then triggers seq 0 to change the tempo of the ticking timer. This is all programmed internally in seq 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see (more or less)
Could you put a comment until this is documented, maybe something like With ACTOR_FLAG_28 the sfx value is not a sfx id, see func_80030ED8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even more specifically, they're indices to this table here, which then applies a delay to when the next "tick" is in the timer
https://github.com/MNGoldenEagle/oot/blob/fb5bcb9e5e9bfa5e9735c9a3015aa32d896a1767/assets/sequences/sfxbanks/env.seq.inc#L740-L744
Except the indices are offset by 1 (actor->sfx = 1; // index 0
) so that it passes the actor->sfx != 0
check needed to play the sfx. Then the (s8)(actor->sfx - 1)
gets the true index
Yeah, I can add a temporary comment. I'll also be tackling this function in the near future as well
func_80078914(&this->actor.projectedPos, NA_SE_VO_SK_CRASH); | ||
} else if (Animation_OnFrame(skelAnime, 26.0f)) { | ||
func_80078914(&this->actor.projectedPos, NA_SE_PL_BOUND_GRASS); | ||
func_80078914(&this->actor.projectedPos, NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_GRASS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this kind of change necessary? Why not just have NA_SE_PL_BOUND_GRASS
? (idk)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this one is debatable and I'm still on the fence for it, but I feel it's good to always treat these player sfx id's as base + materialOffset + ageOffset
because that's how it's designed. A huge number of sfxId's are all labelled DUMMY_
in the player bank because while they're all valid sfx, their mainly accessed through their base and offset. Just look at the player sfxId's at 0x80 - 0x8F
, 0x90 - 0x9F
, 0xA0 - 0xAF
. But maybe long term when we properly name all sfxId's, we will be giving them all names based on combinations of base + material offset + age offset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key thing that bothers me is as you said
these player sfx id's
so I understand it in the context of player, but this is just an actor randomly using a player sfx for its own purpose, it doesn't care all that much about the layout of the player bank?
(I'm on the fence too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this specific actor is even weirder because it does use SurfaceType_GetSfxOffset
so it's a poor example
The point stands for others though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. These "player sfxIds" are called "player" because the og name for this was "Player Bank". However, as you mentioned, some actors use these for themselves (non-player actors), like walking most commonly, but other sfx as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actor specifically (Sheik) uses a hardcoded sfxId/material/offset because it's cutscene based, so it's all predetermined where she'll be walking (is my interpretation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actor uses of this kind of concept are
Fishing in Fishing_UpdateLure
(who would have guessed):
func_80078914(&D_80B7AF94, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND);
Ganon in BossGanon_HitByLightBall
:
Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_TALL_GRASS);
Nabooru in EnNb_PlayLookRightSFX
and EnNb_PlayLookLeftSFX
func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE);
Ruto (child) in undocumented territory:
func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_JABU);
Sheik in EnXc_SetThrownAroundSFX
func_80078914(&this->actor.projectedPos, NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_GRASS);
func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_GRASS);
Saria in undocumented territory:
Audio_PlaySfxGeneral(NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT, ...)
Talon in EnTa_RunWithAccelerationAndSfx
Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT);
Adult Zelda (Cutscenes) in undocumented territory:
Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT);
@@ -3170,8 +3170,7 @@ void Message_Update(PlayState* play) { | |||
R_TEXTBOX_TEXHEIGHT = 512; | |||
} else { | |||
Message_GrowTextbox(msgCtx); | |||
// TODO: this may be NA_SE_PL_WALK_GROUND - SFX_FLAG, or not, investigate sfxId=0 | |||
Audio_PlaySfxIfNotInCutscene(0); | |||
Audio_PlaySfxIfNotInCutscene(NA_SE_NONE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this was (un)intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a textbox growing sound effect in beta (can hear it in some spaceworld era vids)
They likely just put a raw 0 in there to "comment it out" without removing the whole call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hard to say, I think Fig hypothesized that these were likely actual sounds in earlier releases (sw97) and that the sounds were too obnoxious or not right, so they put a NONE
here to silence this sfx (maybe there was a debug conditional)? But I kinda lean into that kind of concept, so I suspect this was intentional and they were messing around with different sfx at this spot, but the final decision was to not include one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lmao. Beat me to the punch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Do not really have any opinion on using the sfx directly for some actors, instead of adding the surface offset.
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT, | ||
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT, | ||
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT, | ||
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND, | ||
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE, | ||
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_JABU, | ||
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WATER_SHALLOW, | ||
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WATER_DEEP, | ||
NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_TALL_GRASS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you intend to delete the other constants, I don't think it's necessary to split sound effects in cases where they are intended to be called directly.
@@ -1751,7 +1751,7 @@ void func_808327F8(Player* this, f32 arg1) { | |||
s32 sfxId; | |||
|
|||
if (this->currentBoots == PLAYER_BOOTS_IRON) { | |||
sfxId = NA_SE_PL_WALK_HEAVYBOOTS; | |||
sfxId = NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_IRON_BOOTS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sfxId = NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_IRON_BOOTS; | |
sfxId = NA_SE_PL_WALK_HEAVYBOOTS; |
Same point here; NA_SE_PL_WALK_HEAVYBOOTS
already expresses NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_IRON_BOOTS
@@ -1763,7 +1763,7 @@ void func_80832854(Player* this) { | |||
s32 sfxId; | |||
|
|||
if (this->currentBoots == PLAYER_BOOTS_IRON) { | |||
sfxId = NA_SE_PL_JUMP_HEAVYBOOTS; | |||
sfxId = NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_IRON_BOOTS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sfxId = NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_IRON_BOOTS; | |
sfxId = NA_SE_PL_JUMP_HEAVYBOOTS; |
@@ -1775,7 +1775,7 @@ void func_808328A0(Player* this) { | |||
s32 sfxId; | |||
|
|||
if (this->currentBoots == PLAYER_BOOTS_IRON) { | |||
sfxId = NA_SE_PL_LAND_HEAVYBOOTS; | |||
sfxId = NA_SE_PL_LAND + SURFACE_SFX_OFFSET_IRON_BOOTS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sfxId = NA_SE_PL_LAND + SURFACE_SFX_OFFSET_IRON_BOOTS; | |
sfxId = NA_SE_PL_LAND_HEAVYBOOTS; |
u32 SurfaceType_GetSfxType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); | ||
u16 SurfaceType_GetSfxId(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); | ||
u32 SurfaceType_GetMaterial(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); | ||
u16 SurfaceType_GetSfxOffset(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u16 SurfaceType_GetSfxOffset(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); | |
u16 SurfaceType_GetSfxMaterial(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); |
It's a personal preference, but I think the name should retain the fact that it selects a material
* material * cleanup * iron boots * climb * more docs * rename * small fix * comments * adjust bug comment * simplify comment
This came up from a conversation in MM but this looks to document the values stored in
surfaceTypes[poly->type].data[1] & 0xF
which I'm currently calling "MATERIAL", and the values of the sfxOffset based on sequence 0 using the audio extraction PR:#1236, which I'm calling "SFX_OFFSET"
These two sets of values (material/sfxOffset) mostly line up, but there are some values that do not.