From c7a61aa670cb4843bffde11bc8dfa0f0301ee35b Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sat, 26 Nov 2022 18:11:06 -0500 Subject: [PATCH] Document Surface Material (#1447) * material * cleanup * iron boots * climb * more docs * rename * small fix * comments * adjust bug comment * simplify comment --- include/functions.h | 4 +- include/sfx.h | 1 + include/z64bgcheck.h | 51 +++-- include/z64player.h | 4 +- src/code/z_actor.c | 25 ++- src/code/z_bgcheck.c | 42 ++-- src/code/z_camera.c | 2 +- src/code/z_collision_check.c | 8 +- src/code/z_message_PAL.c | 3 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 6 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 4 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 4 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 205 +++++++++--------- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 4 +- .../actors/ovl_En_Encount1/z_en_encount1.c | 2 +- src/overlays/actors/ovl_En_Js/z_en_js.c | 4 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 4 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 4 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 4 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 2 +- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 22 +- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 6 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 4 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 7 +- .../actors/ovl_player_actor/z_player.c | 70 +++--- 26 files changed, 263 insertions(+), 231 deletions(-) diff --git a/include/functions.h b/include/functions.h index 2991393ed4..d017977d4f 100644 --- a/include/functions.h +++ b/include/functions.h @@ -602,8 +602,8 @@ s32 SurfaceType_CheckWallFlag2(CollisionContext* colCtx, CollisionPoly* poly, s3 u32 SurfaceType_GetFloorProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_IsSoft(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -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); u32 SurfaceType_GetFloorEffect(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetLightSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); diff --git a/include/sfx.h b/include/sfx.h index 373cbc0d9b..c066fb8073 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -58,6 +58,7 @@ typedef struct { #define DEFINE_SFX(enum, _1, _2, _3, _4) enum, typedef enum { + NA_SE_NONE, // Requesting a sfx with this id will play no sound NA_SE_PL_BASE = 0x7FF, #include "tables/sfx/playerbank_table.h" NA_SE_IT_BASE = 0x17FF, diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index fa90ab78d8..aa25557c11 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -162,22 +162,41 @@ typedef enum { } FloorProperty; typedef enum { - /* 0 */ SURFACE_SFX_TYPE_0, - /* 1 */ SURFACE_SFX_TYPE_1, - /* 2 */ SURFACE_SFX_TYPE_2, - /* 3 */ SURFACE_SFX_TYPE_3, - /* 4 */ SURFACE_SFX_TYPE_4, - /* 5 */ SURFACE_SFX_TYPE_5, - /* 6 */ SURFACE_SFX_TYPE_6, - /* 7 */ SURFACE_SFX_TYPE_7, - /* 8 */ SURFACE_SFX_TYPE_8, - /* 9 */ SURFACE_SFX_TYPE_9, - /* 10 */ SURFACE_SFX_TYPE_10, - /* 11 */ SURFACE_SFX_TYPE_11, - /* 12 */ SURFACE_SFX_TYPE_12, - /* 13 */ SURFACE_SFX_TYPE_13, - /* 14 */ SURFACE_SFX_TYPE_MAX -} SurfaceSfxType; + /* 0 */ SURFACE_SFX_OFFSET_DIRT, + /* 1 */ SURFACE_SFX_OFFSET_SAND, + /* 2 */ SURFACE_SFX_OFFSET_STONE, + /* 3 */ SURFACE_SFX_OFFSET_JABU, + /* 4 */ SURFACE_SFX_OFFSET_WATER_SHALLOW, + /* 5 */ SURFACE_SFX_OFFSET_WATER_DEEP, + /* 6 */ SURFACE_SFX_OFFSET_TALL_GRASS, + /* 7 */ SURFACE_SFX_OFFSET_LAVA, // MAGMA? + /* 8 */ SURFACE_SFX_OFFSET_GRASS, + /* 9 */ SURFACE_SFX_OFFSET_CARPET, + /* 10 */ SURFACE_SFX_OFFSET_WOOD, + /* 11 */ SURFACE_SFX_OFFSET_BRIDGE, // WOOD_PLANK? + /* 12 */ SURFACE_SFX_OFFSET_VINE, + /* 13 */ SURFACE_SFX_OFFSET_IRON_BOOTS, + /* 14 */ SURFACE_SFX_OFFSET_UNUSED, + /* 15 */ SURFACE_SFX_OFFSET_ICE +} SurfaceSfxOffset; + +typedef enum { + /* 0 */ SURFACE_MATERIAL_DIRT, + /* 1 */ SURFACE_MATERIAL_SAND, + /* 2 */ SURFACE_MATERIAL_STONE, + /* 3 */ SURFACE_MATERIAL_JABU, + /* 4 */ SURFACE_MATERIAL_WATER_SHALLOW, + /* 5 */ SURFACE_MATERIAL_WATER_DEEP, + /* 6 */ SURFACE_MATERIAL_TALL_GRASS, + /* 7 */ SURFACE_MATERIAL_LAVA, // MAGMA? + /* 8 */ SURFACE_MATERIAL_GRASS, + /* 9 */ SURFACE_MATERIAL_BRIDGE, // WOOD_PLANK? + /* 10 */ SURFACE_MATERIAL_WOOD, + /* 11 */ SURFACE_MATERIAL_DIRT_SOFT, + /* 12 */ SURFACE_MATERIAL_ICE, + /* 13 */ SURFACE_MATERIAL_CARPET, + /* 14 */ SURFACE_MATERIAL_MAX +} SurfaceMaterial; typedef enum { /* 0 */ FLOOR_EFFECT_0, diff --git a/include/z64player.h b/include/z64player.h index 5ea1aeb8db..8a75c4d5bd 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -621,7 +621,7 @@ typedef struct Player { /* 0x0898 */ s16 unk_898; /* 0x089A */ s16 unk_89A; /* 0x089C */ s16 unk_89C; - /* 0x089E */ u16 unk_89E; + /* 0x089E */ u16 floorSfxOffset; /* 0x08A0 */ u8 unk_8A0; /* 0x08A1 */ u8 unk_8A1; /* 0x08A2 */ s16 unk_8A2; @@ -643,7 +643,7 @@ typedef struct Player { /* 0x0A7B */ u8 unk_A7B; /* 0x0A7C */ f32 unk_A7C; /* 0x0A80 */ s16 unk_A80; - /* 0x0A82 */ u16 unk_A82; + /* 0x0A82 */ u16 prevFloorSfxOffset; /* 0x0A84 */ s16 unk_A84; /* 0x0A86 */ s8 unk_A86; /* 0x0A87 */ u8 unk_A87; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 48dd45f094..8197e5f18e 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1701,20 +1701,20 @@ void Audio_PlayActorSfx2(Actor* actor, u16 sfxId) { } void func_8002F850(PlayState* play, Actor* actor) { - s32 sfxId; + s32 surfaceSfxOffset; if (actor->bgCheckFlags & BGCHECKFLAG_WATER) { if (actor->yDistToWater < 20.0f) { - sfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW; } else { - sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP; } } else { - sfxId = SurfaceType_GetSfxId(&play->colCtx, actor->floorPoly, actor->floorBgId); + surfaceSfxOffset = SurfaceType_GetSfxOffset(&play->colCtx, actor->floorPoly, actor->floorBgId); } func_80078914(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); - func_80078914(&actor->projectedPos, sfxId + SFX_FLAG); + func_80078914(&actor->projectedPos, NA_SE_PL_WALK_GROUND + surfaceSfxOffset); } void func_8002F8F0(Actor* actor, u16 sfxId) { @@ -1740,15 +1740,18 @@ void func_8002F974(Actor* actor, u16 sfxId) { actor->sfx = sfxId; } -void func_8002F994(Actor* actor, s32 arg1) { +void func_8002F994(Actor* actor, s32 timer) { actor->flags |= ACTOR_FLAG_28; actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21); - if (arg1 < 40) { - actor->sfx = NA_SE_PL_WALK_DIRT - SFX_FLAG; - } else if (arg1 < 100) { - actor->sfx = NA_SE_PL_WALK_CONCRETE - SFX_FLAG; + + // The sfx field is not used for an actual sound effect here. + // Instead, it controls the tick speed of the timer sound effect. + if (timer < 40) { + actor->sfx = 3; + } else if (timer < 100) { + actor->sfx = 2; } else { - actor->sfx = NA_SE_PL_WALK_SAND - SFX_FLAG; + actor->sfx = 1; } } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index e6592e7dfe..0897474572 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -68,21 +68,21 @@ s32 D_80119D90[WALL_TYPE_MAX] = { WALL_FLAG_6, // WALL_TYPE_7 }; -u16 D_80119E10[SURFACE_SFX_TYPE_MAX] = { - NA_SE_PL_WALK_GROUND - SFX_FLAG, // SURFACE_SFX_TYPE_0 - NA_SE_PL_WALK_SAND - SFX_FLAG, // SURFACE_SFX_TYPE_1 - NA_SE_PL_WALK_CONCRETE - SFX_FLAG, // SURFACE_SFX_TYPE_2 - NA_SE_PL_WALK_DIRT - SFX_FLAG, // SURFACE_SFX_TYPE_3 - NA_SE_PL_WALK_WATER0 - SFX_FLAG, // SURFACE_SFX_TYPE_4 - NA_SE_PL_WALK_WATER1 - SFX_FLAG, // SURFACE_SFX_TYPE_5 - NA_SE_PL_WALK_WATER2 - SFX_FLAG, // SURFACE_SFX_TYPE_6 - NA_SE_PL_WALK_MAGMA - SFX_FLAG, // SURFACE_SFX_TYPE_7 - NA_SE_PL_WALK_GRASS - SFX_FLAG, // SURFACE_SFX_TYPE_8 - NA_SE_PL_WALK_GLASS - SFX_FLAG, // SURFACE_SFX_TYPE_9 - NA_SE_PL_WALK_LADDER - SFX_FLAG, // SURFACE_SFX_TYPE_10 - NA_SE_PL_WALK_GROUND - SFX_FLAG, // SURFACE_SFX_TYPE_11 - NA_SE_PL_WALK_ICE - SFX_FLAG, // SURFACE_SFX_TYPE_12 - NA_SE_PL_WALK_IRON - SFX_FLAG, // SURFACE_SFX_TYPE_13 +u16 sSurfaceMaterialToSfxOffset[SURFACE_MATERIAL_MAX] = { + SURFACE_SFX_OFFSET_DIRT, // SURFACE_MATERIAL_DIRT + SURFACE_SFX_OFFSET_SAND, // SURFACE_MATERIAL_SAND + SURFACE_SFX_OFFSET_STONE, // SURFACE_MATERIAL_STONE + SURFACE_SFX_OFFSET_JABU, // SURFACE_MATERIAL_JABU + SURFACE_SFX_OFFSET_WATER_SHALLOW, // SURFACE_MATERIAL_WATER_SHALLOW + SURFACE_SFX_OFFSET_WATER_DEEP, // SURFACE_MATERIAL_WATER_DEEP + SURFACE_SFX_OFFSET_TALL_GRASS, // SURFACE_MATERIAL_TALL_GRASS + SURFACE_SFX_OFFSET_LAVA, // SURFACE_MATERIAL_LAVA + SURFACE_SFX_OFFSET_GRASS, // SURFACE_MATERIAL_GRASS + SURFACE_SFX_OFFSET_BRIDGE, // SURFACE_MATERIAL_BRIDGE + SURFACE_SFX_OFFSET_WOOD, // SURFACE_MATERIAL_WOOD + SURFACE_SFX_OFFSET_DIRT, // SURFACE_MATERIAL_DIRT_SOFT + SURFACE_SFX_OFFSET_ICE, // SURFACE_MATERIAL_ICE + SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET }; /** @@ -4111,17 +4111,17 @@ u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s3 return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 31 & 1; } -u32 SurfaceType_GetSfxType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +u32 SurfaceType_GetMaterial(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 1) & 0xF; } -u16 SurfaceType_GetSfxId(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - s32 sfxType = SurfaceType_GetSfxType(colCtx, poly, bgId); +u16 SurfaceType_GetSfxOffset(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { + s32 surfaceMaterial = SurfaceType_GetMaterial(colCtx, poly, bgId); - if (sfxType < 0 || sfxType >= ARRAY_COUNT(D_80119E10)) { - return NA_SE_PL_WALK_GROUND - SFX_FLAG; + if ((surfaceMaterial < 0) || (surfaceMaterial >= ARRAY_COUNT(sSurfaceMaterialToSfxOffset))) { + return SURFACE_SFX_OFFSET_DIRT; } - return D_80119E10[sfxType]; + return sSurfaceMaterialToSfxOffset[surfaceMaterial]; } u32 SurfaceType_GetFloorEffect(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 81a032f7e0..24b227733d 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -4501,7 +4501,7 @@ s32 Camera_Subj4(Camera* camera) { if ((eyeLerp > rwData->eyeLerp) && !rwData->isSfxOff) { player = camera->player; rwData->isSfxOff = true; - func_800F4010(&player->actor.projectedPos, NA_SE_PL_CRAWL + player->unk_89E, 4.0f); + func_800F4010(&player->actor.projectedPos, NA_SE_PL_CRAWL + player->floorSfxOffset, 4.0f); } else if (eyeLerp < rwData->eyeLerp) { rwData->isSfxOff = false; } diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 6ac812d6bf..7c4d4259a6 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1610,11 +1610,11 @@ s32 CollisionCheck_SwordHitAudio(Collider* at, ColliderInfo* acInfo) { Audio_PlaySfxGeneral(NA_SE_IT_SWORD_STRIKE_HARD, &at->actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else if (acInfo->elemType == ELEMTYPE_UNK2) { - Audio_PlaySfxGeneral(NA_SE_PL_WALK_GROUND - SFX_FLAG, &at->actor->projectedPos, 4, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + Audio_PlaySfxGeneral(NA_SE_NONE, &at->actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else if (acInfo->elemType == ELEMTYPE_UNK3) { - Audio_PlaySfxGeneral(NA_SE_PL_WALK_GROUND - SFX_FLAG, &at->actor->projectedPos, 4, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + Audio_PlaySfxGeneral(NA_SE_NONE, &at->actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } return true; diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index 31f8509580..8ca1a884d1 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -3172,8 +3172,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); msgCtx->stateTimer = 0; msgCtx->msgMode = MSGMODE_TEXT_BOX_GROWING; } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 0f3487c8fe..47d85407a4 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -251,9 +251,9 @@ void func_8088B79C(BgHidanRock* this, PlayState* play) { } Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Audio_PlayActorSfx2( - &this->dyna.actor, - SurfaceType_GetSfxId(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + SFX_FLAG); + Audio_PlayActorSfx2(&this->dyna.actor, + NA_SE_PL_WALK_GROUND + SurfaceType_GetSfxOffset(&play->colCtx, this->dyna.actor.floorPoly, + this->dyna.actor.floorBgId)); } this->unk_16C -= 0.5f; diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 8541e84b40..1899ab8cda 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -2465,7 +2465,7 @@ void BossGanon_HitByLightBall(BossGanon* this, PlayState* play) { BossGanonEff_SpawnSparkle(play, &this->unk_1FC, &sp50, &sZeroVec, Rand_ZeroFloat(200.0f) + 500.0f, 0x14); } - Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_WATER2); + Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_TALL_GRASS); } if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { @@ -2647,7 +2647,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) { 0x14); } - Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_WATER2); + Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_TALL_GRASS); this->timers[3] = 50; } diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 70d2a663e6..1ab566705e 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -1239,7 +1239,7 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, PlayState* play) { } if (this->flyMode != GND_FLY_PAINTING) { if (acHit && (this->actionFunc != BossGanondrof_Stunned) && (hurtbox->toucher.dmgFlags & DMG_RANGED)) { - Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND - SFX_FLAG); + Audio_PlayActorSfx2(&this->actor, NA_SE_NONE); osSyncPrintf("hit != 0 \n"); } else if (this->actionFunc != BossGanondrof_Charge) { if (this->returnCount == 0) { @@ -1270,7 +1270,7 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, PlayState* play) { horse->hitTimer = 20; Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FANTOM_DAMAGE); } else { - Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND - SFX_FLAG); + Audio_PlayActorSfx2(&this->actor, NA_SE_NONE); } } else if (acHit && (hurtbox->toucher.dmgFlags & DMG_RANGED)) { this->work[GND_INVINC_TIMER] = 10; diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 70a29beffa..3ed0182655 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -3040,53 +3040,56 @@ void BossMo_Unknown(void) { // Appears to be a test function for sound effects. static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static u16 unkSfx[] = { - NA_SE_PL_WALK_GROUND, - NA_SE_PL_WALK_GROUND, - NA_SE_PL_WALK_GROUND, - NA_SE_PL_WALK_SAND, - NA_SE_PL_WALK_CONCRETE, - NA_SE_PL_WALK_DIRT, - NA_SE_PL_WALK_WATER0, - NA_SE_PL_WALK_WATER1, - NA_SE_PL_WALK_WATER2, - NA_SE_PL_WALK_MAGMA, - NA_SE_PL_WALK_GRASS, - NA_SE_PL_WALK_GLASS, - NA_SE_PL_WALK_LADDER, - NA_SE_PL_WALK_GLASS, - NA_SE_PL_WALK_WALL, - NA_SE_PL_WALK_HEAVYBOOTS, - NA_SE_PL_WALK_ICE, - NA_SE_PL_JUMP, - NA_SE_PL_JUMP, - NA_SE_PL_JUMP_SAND, - NA_SE_PL_JUMP_CONCRETE, - NA_SE_PL_JUMP_DIRT, - NA_SE_PL_JUMP_WATER0, - NA_SE_PL_JUMP_WATER1, - NA_SE_PL_JUMP_WATER2, - NA_SE_PL_JUMP_MAGMA, - NA_SE_PL_JUMP_GRASS, - NA_SE_PL_JUMP_GLASS, - NA_SE_PL_JUMP_LADDER, - NA_SE_PL_JUMP_GLASS, - NA_SE_PL_JUMP_HEAVYBOOTS, - NA_SE_PL_JUMP_ICE, - NA_SE_PL_LAND, - NA_SE_PL_LAND, - NA_SE_PL_LAND_SAND, - NA_SE_PL_LAND_CONCRETE, - NA_SE_PL_LAND_DIRT, - NA_SE_PL_LAND_WATER0, - NA_SE_PL_LAND_WATER1, - NA_SE_PL_LAND_WATER2, - NA_SE_PL_LAND_MAGMA, - NA_SE_PL_LAND_GRASS, - NA_SE_PL_LAND_GLASS, - NA_SE_PL_LAND_LADDER, - NA_SE_PL_LAND_GLASS, - NA_SE_PL_LAND_HEAVYBOOTS, - NA_SE_PL_LAND_ICE, + // Walking + 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, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_LAVA, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_GRASS, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_VINE, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_IRON_BOOTS, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_ICE, + // Jumping + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_SAND, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_STONE, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_JABU, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_WATER_SHALLOW, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_WATER_DEEP, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_TALL_GRASS, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_LAVA, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_GRASS, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_WOOD, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_IRON_BOOTS, + NA_SE_PL_JUMP + SURFACE_SFX_OFFSET_ICE, + // Landing + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_SAND, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_STONE, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_JABU, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_WATER_SHALLOW, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_WATER_DEEP, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_TALL_GRASS, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_LAVA, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_GRASS, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_WOOD, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_IRON_BOOTS, + NA_SE_PL_LAND + SURFACE_SFX_OFFSET_ICE, NA_SE_PL_SLIPDOWN, NA_SE_PL_CLIMB_CLIFF, NA_SE_PL_CLIMB_CLIFF, @@ -3114,37 +3117,39 @@ void BossMo_Unknown(void) { NA_SE_PL_SKIP, NA_SE_PL_BODY_HIT, NA_SE_PL_DAMAGE, - NA_SE_PL_SLIP, - NA_SE_PL_SLIP, - NA_SE_PL_SLIP, - NA_SE_PL_SLIP_SAND, - NA_SE_PL_SLIP_CONCRETE, - NA_SE_PL_SLIP_DIRT, - NA_SE_PL_SLIP_WATER0, - NA_SE_PL_SLIP_WATER1, - NA_SE_PL_SLIP_WATER2, - NA_SE_PL_SLIP_MAGMA, - NA_SE_PL_SLIP_GRASS, - NA_SE_PL_SLIP_GLASS, - NA_SE_PL_SLIP_LADDER, - NA_SE_PL_SLIP_GLASS, - NA_SE_PL_SLIP_HEAVYBOOTS, - NA_SE_PL_SLIP_ICE, - NA_SE_PL_BOUND, - NA_SE_PL_BOUND, - NA_SE_PL_BOUND_SAND, - NA_SE_PL_BOUND_CONCRETE, - NA_SE_PL_BOUND_DIRT, - NA_SE_PL_BOUND_WATER0, - NA_SE_PL_BOUND_WATER1, - NA_SE_PL_BOUND_WATER2, - NA_SE_PL_BOUND_MAGMA, - NA_SE_PL_BOUND_GRASS, - NA_SE_PL_BOUND_WOOD, - NA_SE_PL_BOUND_LADDER, - NA_SE_PL_BOUND_WOOD, - NA_SE_PL_BOUND_HEAVYBOOTS, - NA_SE_PL_BOUND_ICE, + // Slipping + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_SAND, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_STONE, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_JABU, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_WATER_SHALLOW, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_WATER_DEEP, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_TALL_GRASS, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_LAVA, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_GRASS, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_WOOD, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_IRON_BOOTS, + NA_SE_PL_SLIP + SURFACE_SFX_OFFSET_ICE, + // Bound + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_DIRT, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_SAND, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_STONE, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_JABU, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_WATER_SHALLOW, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_WATER_DEEP, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_TALL_GRASS, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_LAVA, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_GRASS, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_WOOD, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_BRIDGE, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_IRON_BOOTS, + NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_ICE, NA_SE_PL_FACE_UP, NA_SE_PL_DIVE_BUBBLE, NA_SE_PL_MOVE_BUBBLE, @@ -3175,8 +3180,8 @@ void BossMo_Unknown(void) { NA_SE_IT_ARROW_STICK_CRE, NA_SE_IT_ARROW_STICK_CRE, NA_SE_IT_ARROW_STICK_OBJ, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, + NA_SE_NONE, + NA_SE_NONE, NA_SE_IT_SWORD_SWING_HARD, NA_SE_IT_WALL_HIT_HARD, NA_SE_IT_WALL_HIT_SOFT, @@ -3289,8 +3294,8 @@ void BossMo_Unknown(void) { NA_SE_EV_TREE_CUT, NA_SE_EV_WATERDROP, NA_SE_EV_TORCH, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, + NA_SE_NONE, + NA_SE_NONE, NA_SE_EN_DODO_J_WALK, NA_SE_EN_DODO_J_CRY, NA_SE_EN_DODO_J_FIRE - SFX_FLAG, @@ -3441,13 +3446,13 @@ void BossMo_Unknown(void) { NA_SE_EN_OCTAROCK_LAND, NA_SE_EN_OCTAROCK_SINK, NA_SE_EN_OCTAROCK_BUBLE, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, NA_SE_SY_WIN_OPEN, NA_SE_SY_WIN_CLOSE, NA_SE_SY_CORRECT_CHIME, @@ -3463,7 +3468,7 @@ void BossMo_Unknown(void) { NA_SE_SY_HP_RECOVER, NA_SE_SY_ATTENTION_ON, NA_SE_SY_ATTENTION_ON, - NA_SE_PL_WALK_GROUND - SFX_FLAG, + NA_SE_NONE, NA_SE_SY_LOCK_ON, NA_SE_SY_LOCK_ON, NA_SE_SY_LOCK_OFF, @@ -3473,9 +3478,9 @@ void BossMo_Unknown(void) { NA_SE_SY_ATTENTION_ON_OLD, NA_SE_SY_ATTENTION_URGENCY, NA_SE_SY_MESSAGE_PASS, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, NA_SE_SY_PIECE_OF_HEART, NA_SE_SY_GET_ITEM, NA_SE_SY_WIN_SCROLL_LEFT, @@ -3488,7 +3493,7 @@ void BossMo_Unknown(void) { NA_SE_SY_ATTENTION_ON, NA_SE_SY_ATTENTION_URGENCY, NA_SE_OC_OCARINA, - NA_SE_PL_WALK_GROUND - SFX_FLAG, + NA_SE_NONE, NA_SE_PL_LAND - SFX_FLAG, NA_SE_VO_LI_SWORD_N, NA_SE_VO_LI_SWORD_N, @@ -3566,12 +3571,12 @@ void BossMo_Unknown(void) { NA_SE_EN_DEADHAND_BITE, NA_SE_EN_DEADHAND_WALK, NA_SE_EN_DEADHAND_GRIP, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, - NA_SE_PL_WALK_GROUND - SFX_FLAG, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, + NA_SE_NONE, }; if (BREG(32) != 0) { diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 20d5187e6c..1caa9a4cd0 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -717,9 +717,9 @@ void func_8098652C(DemoIm* this, PlayState* play) { void func_80986570(DemoIm* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 7.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - u32 sfxId = SFX_FLAG; + u32 sfxId = NA_SE_PL_WALK_GROUND; - sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId += SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); Audio_PlaySfxGeneral(sfxId, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index f3c4409ccc..3b66706ccc 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -241,7 +241,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { while ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { if (play->sceneId == SCENE_HYRULE_FIELD) { - if ((player->unk_89E == SURFACE_SFX_TYPE_0) || (player->actor.floorBgId != BGCHECK_SCENE) || + if ((player->floorSfxOffset == SURFACE_SFX_OFFSET_DIRT) || (player->actor.floorBgId != BGCHECK_SCENE) || !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (player->stateFlags1 & PLAYER_STATE1_27)) { this->fieldSpawnTimer = 60; diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index ddef053fc2..29e60e1e10 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -174,8 +174,8 @@ void EnJs_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == - (NA_SE_PL_WALK_SAND - SFX_FLAG)) { + if (SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == + SURFACE_SFX_OFFSET_SAND) { Math_ApproachF(&this->actor.shape.yOffset, sREG(80) + -2000.0f, 1.0f, (sREG(81) / 10.0f) + 50.0f); } } else { diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index c39864388f..1580e18ba3 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -717,7 +717,7 @@ void EnNb_PlayLookRightSFX(EnNb* this) { s32 pad[2]; if ((this->skelAnime.mode == 2) && Animation_OnFrame(&this->skelAnime, 9.0f)) { - func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_CONCRETE); + func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE); } } @@ -725,7 +725,7 @@ void EnNb_PlayLookLeftSFX(EnNb* this) { s32 pad[2]; if (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { - func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_CONCRETE); + func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE); } } diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 2ec803cba9..e10a3efaf5 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -833,7 +833,7 @@ void func_80AEC650(EnRu1* this) { if (this->unk_280 == 0) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { - func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_DIRT); + func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_JABU); } } } @@ -1899,7 +1899,7 @@ void func_80AEF40C(EnRu1* this) { if (Animation_OnFrame(skelAnime, 2.0f) || Animation_OnFrame(skelAnime, 7.0f) || Animation_OnFrame(skelAnime, 12.0f) || Animation_OnFrame(skelAnime, 18.0f) || Animation_OnFrame(skelAnime, 25.0f) || Animation_OnFrame(skelAnime, 33.0f)) { - func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_DIRT); + func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_JABU); } } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 9a66ca44c3..50847cc7d3 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -676,8 +676,8 @@ void func_80AF68E4(EnSa* this, PlayState* play) { phi_v0 = this->unk_20C; } if (phi_v0 == 0) { - Audio_PlaySfxGeneral(NA_SE_PL_WALK_GROUND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + Audio_PlaySfxGeneral(NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT, &this->actor.projectedPos, 4, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->unk_20C = 8; } } diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 2dc613875e..9d15dfba08 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -431,7 +431,7 @@ void EnTa_RunWithAccelerationAndSfx(EnTa* this, PlayState* play) { s32 framesMod12 = (s32)play->state.frames % 12; if (framesMod12 == 0 || framesMod12 == 6) { - Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND); + Audio_PlayActorSfx2(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_DIRT); } if (this->actor.speedXZ < 6.0f) { this->actor.speedXZ += 0.4f; diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index d59673d4fa..52bfeda40b 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -371,8 +371,8 @@ void EnXc_SetWalkingSFX(EnXc* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 11.0f) || Animation_OnFrame(&this->skelAnime, 23.0f)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId = NA_SE_PL_WALK_GROUND; + sfxId += SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } @@ -385,8 +385,8 @@ void EnXc_SetNutThrowSFX(EnXc* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId = NA_SE_PL_WALK_GROUND; + sfxId += SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } @@ -401,8 +401,8 @@ void EnXc_SetLandingSFX(EnXc* this, PlayState* play) { if ((gSaveContext.sceneLayer != 4) || (sceneId != SCENE_DESERT_COLOSSUS)) { if (Animation_OnFrame(&this->skelAnime, 11.0f)) { - sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId = NA_SE_PL_WALK_GROUND; + sfxId += SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } @@ -429,7 +429,7 @@ void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { s32 pad; SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &sXyzDist, wDest); - func_80078914(&sXyzDist, NA_SE_PL_WALK_CONCRETE); + func_80078914(&sXyzDist, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE); } } } @@ -1746,14 +1746,14 @@ void EnXc_SetThrownAroundSFX(EnXc* this) { SkelAnime* skelAnime = &this->skelAnime; if (Animation_OnFrame(skelAnime, 9.0f)) { - func_80078914(&this->actor.projectedPos, NA_SE_PL_BOUND_GRASS); + func_80078914(&this->actor.projectedPos, NA_SE_PL_BOUND + SURFACE_SFX_OFFSET_GRASS); 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); } else if (Animation_OnFrame(skelAnime, 28.0f)) { - func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GRASS); + func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_GRASS); } else if (Animation_OnFrame(skelAnime, 34.0f)) { - func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GRASS); + func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_GRASS); } } diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index 69989faa62..05de71255f 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -589,7 +589,7 @@ void func_80B4FD90(EnZl2* this, PlayState* play) { void func_80B4FDD4(EnZl2* this) { if (Animation_OnFrame(&this->skelAnime, 14.0f)) { - func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_CONCRETE); + func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE); } } @@ -1436,8 +1436,8 @@ void func_80B51D24(EnZl2* this, PlayState* play) { if (Animation_OnFrame(skelAnime, 6.0f) || Animation_OnFrame(skelAnime, 0.0f)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - sfxId = SFX_FLAG; - sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId = NA_SE_PL_WALK_GROUND; + sfxId += SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 364f2809a2..e1c65ac61f 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -1541,8 +1541,8 @@ void func_80B56E38(EnZl3* this, PlayState* play) { if ((Animation_OnFrame(sp20, 6.0f) || Animation_OnFrame(sp20, 0.0f)) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - sfxId = 0x800; - sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + sfxId = NA_SE_PL_WALK_GROUND; + sfxId += SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); } } diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index b8846fde1e..e15e3cdd24 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -2479,7 +2479,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { sLureRot.x = 0.0f; if (CHECK_BTN_ALL(input->press.button, BTN_B)) { D_80B7E144 += 6.0f; - func_80078914(&D_80B7AF94, NA_SE_PL_WALK_SAND); + func_80078914(&D_80B7AF94, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND); } } else { if (D_80B7E144 > 150.0f) { diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 4bf58d116c..1c734a05a1 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -605,9 +605,10 @@ void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play) { ObjOshihiki_SetupOnActor(this, play); } Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Audio_PlayActorSfx2(&this->dyna.actor, SurfaceType_GetSfxId(&play->colCtx, this->floorPolys[this->highestFloor], - this->floorBgIds[this->highestFloor]) + - SFX_FLAG); + Audio_PlayActorSfx2(&this->dyna.actor, + NA_SE_PL_WALK_GROUND + SurfaceType_GetSfxOffset(&play->colCtx, + this->floorPolys[this->highestFloor], + this->floorBgIds[this->highestFloor])); } } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 0aef1fec1e..dcb6d3128c 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1732,7 +1732,7 @@ void func_808326F0(Player* this) { } u16 func_8083275C(Player* this, u16 sfxId) { - return sfxId + this->unk_89E; + return sfxId + this->floorSfxOffset; } void func_80832770(Player* this, u16 sfxId) { @@ -1740,7 +1740,7 @@ void func_80832770(Player* this, u16 sfxId) { } u16 func_808327A4(Player* this, u16 sfxId) { - return sfxId + this->unk_89E + this->ageProperties->unk_94; + return sfxId + this->floorSfxOffset + this->ageProperties->unk_94; } void func_808327C4(Player* this, u16 sfxId) { @@ -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; } else { sfxId = func_808327A4(this, NA_SE_PL_WALK_GROUND); } @@ -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; } else { sfxId = func_808327A4(this, NA_SE_PL_JUMP); } @@ -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; } else { sfxId = func_808327A4(this, NA_SE_PL_LAND); } @@ -1815,7 +1815,8 @@ void func_80832924(Player* this, struct_80832924* entry) { } else if (flags == 0x4000) { func_808327F8(this, 0.0f); } else if (flags == 0x4800) { - func_800F4010(&this->actor.projectedPos, this->ageProperties->unk_94 + NA_SE_PL_WALK_LADDER, 0.0f); + func_800F4010(&this->actor.projectedPos, + NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD + this->ageProperties->unk_94, 0.0f); } } cont = (entry->field >= 0); @@ -5058,7 +5059,7 @@ void func_8083AA10(Player* this, PlayState* play) { func_80835C58(play, this, func_8084411C, 1); func_80832440(play, this); - this->unk_89E = this->unk_A82; + this->floorSfxOffset = this->prevFloorSfxOffset; if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE) && !(this->stateFlags1 & PLAYER_STATE1_27) && (D_80853604 != FLOOR_PROPERTY_6) && (D_80853604 != FLOOR_PROPERTY_9) && (D_80853600 > 20.0f) && @@ -7924,7 +7925,7 @@ static Vec3f D_808545C0 = { 0.0f, 0.0f, 0.0f }; s32 func_8084269C(PlayState* play, Player* this) { Vec3f sp2C; - if ((this->unk_89E == SURFACE_SFX_TYPE_0) || (this->unk_89E == SURFACE_SFX_TYPE_1)) { + if ((this->floorSfxOffset == SURFACE_SFX_OFFSET_DIRT) || (this->floorSfxOffset == SURFACE_SFX_OFFSET_SAND)) { func_8084260C(&this->actor.shape.feetPos[FOOT_LEFT], &sp2C, this->actor.floorHeight - this->actor.shape.feetPos[FOOT_LEFT].y, 7.0f, 5.0f); func_800286CC(play, &sp2C, &D_808545B4, &D_808545C0, 50, 30); @@ -8064,13 +8065,13 @@ void func_80842D20(PlayState* play, Player* this) { s32 func_80842DF4(PlayState* play, Player* this) { f32 phi_f2; - CollisionPoly* sp78; - s32 sp74; + CollisionPoly* groundPoly; + s32 bgId; Vec3f sp68; Vec3f sp5C; Vec3f sp50; s32 temp1; - s32 sp48; + s32 surfaceMaterial; if (this->meleeWeaponState > 0) { if (this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) { @@ -8088,11 +8089,11 @@ s32 func_80842DF4(PlayState* play, Player* this) { sp68.y = this->meleeWeaponInfo[0].tip.y + (sp50.y * phi_f2); sp68.z = this->meleeWeaponInfo[0].tip.z + (sp50.z * phi_f2); - if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->meleeWeaponInfo[0].tip, &sp5C, &sp78, true, - false, false, true, &sp74) && - !SurfaceType_IsIgnoredByEntities(&play->colCtx, sp78, sp74) && - (SurfaceType_GetFloorType(&play->colCtx, sp78, sp74) != FLOOR_TYPE_6) && - (func_8002F9EC(play, &this->actor, sp78, sp74, &sp5C) == 0)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->meleeWeaponInfo[0].tip, &sp5C, &groundPoly, + true, false, false, true, &bgId) && + !SurfaceType_IsIgnoredByEntities(&play->colCtx, groundPoly, bgId) && + (SurfaceType_GetFloorType(&play->colCtx, groundPoly, bgId) != FLOOR_TYPE_6) && + (func_8002F9EC(play, &this->actor, groundPoly, bgId, &sp5C) == 0)) { if (this->heldItemAction == PLAYER_IA_HAMMER) { func_80832630(play); @@ -8102,13 +8103,13 @@ s32 func_80842DF4(PlayState* play, Player* this) { } if (this->linearVelocity >= 0.0f) { - sp48 = SurfaceType_GetSfxType(&play->colCtx, sp78, sp74); + surfaceMaterial = SurfaceType_GetMaterial(&play->colCtx, groundPoly, bgId); - if (sp48 == SURFACE_SFX_TYPE_10) { + if (surfaceMaterial == SURFACE_MATERIAL_WOOD) { CollisionCheck_SpawnShieldParticlesWood(play, &sp5C, &this->actor.projectedPos); } else { CollisionCheck_SpawnShieldParticles(play, &sp5C); - if (sp48 == SURFACE_SFX_TYPE_11) { + if (surfaceMaterial == SURFACE_MATERIAL_DIRT_SOFT) { func_8002F7DC(&this->actor, NA_SE_IT_WALL_HIT_SOFT); } else { func_8002F7DC(&this->actor, NA_SE_IT_WALL_HIT_HARD); @@ -10008,20 +10009,19 @@ void func_80847BA0(PlayState* play, Player* this) { if (floorPoly != NULL) { this->unk_A7A = SurfaceType_GetFloorProperty(&play->colCtx, floorPoly, this->actor.floorBgId); - this->unk_A82 = this->unk_89E; + this->prevFloorSfxOffset = this->floorSfxOffset; if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.yDistToWater < 20.0f) { - this->unk_89E = SURFACE_SFX_TYPE_4; + this->floorSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW; } else { - this->unk_89E = SURFACE_SFX_TYPE_5; + this->floorSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP; } } else { if (this->stateFlags2 & PLAYER_STATE2_9) { - this->unk_89E = SURFACE_SFX_TYPE_1; + this->floorSfxOffset = SURFACE_SFX_OFFSET_SAND; } else { - // unk_89E is a sfxType, but SurfaceType_GetSfxId returns a sfxId? - this->unk_89E = SurfaceType_GetSfxId(&play->colCtx, floorPoly, this->actor.floorBgId); + this->floorSfxOffset = SurfaceType_GetSfxOffset(&play->colCtx, floorPoly, this->actor.floorBgId); } } @@ -11565,7 +11565,8 @@ void func_8084BDFC(Player* this, PlayState* play) { } void func_8084BEE4(Player* this) { - func_8002F7DC(&this->actor, (this->unk_84F != 0) ? NA_SE_PL_WALK_WALL : NA_SE_PL_WALK_LADDER); + func_8002F7DC(&this->actor, (this->unk_84F != 0) ? NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_VINE + : NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD); } void func_8084BF1C(Player* this, PlayState* play) { @@ -11715,16 +11716,16 @@ static f32 D_80854898[] = { 10.0f, 20.0f }; static f32 D_808548A0[] = { 40.0f, 50.0f }; static struct_80832924 D_808548A8[] = { - { NA_SE_PL_WALK_LADDER, 0x80A }, - { NA_SE_PL_WALK_LADDER, 0x814 }, - { NA_SE_PL_WALK_LADDER, -0x81E }, + { NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD, 0x80A }, + { NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD, 0x814 }, + { NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WOOD, -0x81E }, }; void func_8084C5F8(Player* this, PlayState* play) { s32 temp; f32* sp38; CollisionPoly* groundPoly; - s32 sp30; + s32 bgId; Vec3f sp24; this->stateFlags2 |= PLAYER_STATE2_6; @@ -11753,8 +11754,11 @@ void func_8084C5F8(Player* this, PlayState* play) { sp24.x = this->actor.world.pos.x; sp24.y = this->actor.world.pos.y + 20.0f; sp24.z = this->actor.world.pos.z; - if (BgCheck_EntityRaycastDown3(&play->colCtx, &groundPoly, &sp30, &sp24) != 0.0f) { - this->unk_89E = SurfaceType_GetSfxType(&play->colCtx, groundPoly, sp30); + if (BgCheck_EntityRaycastDown3(&play->colCtx, &groundPoly, &bgId, &sp24) != 0.0f) { + //! @bug should use `SurfaceType_GetSfxOffset` instead of `SurfaceType_GetMaterial`. + // Most material and sfxOffsets share identical enum values, + // so this will mostly result in the correct sfx played, but not in all cases, such as carpet and ice. + this->floorSfxOffset = SurfaceType_GetMaterial(&play->colCtx, groundPoly, bgId); func_808328A0(this); } } @@ -14307,7 +14311,7 @@ void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static struct_80832924 D_808551C8[] = { - { NA_SE_PL_LAND_LADDER, 0x843 }, + { NA_SE_PL_LAND + SURFACE_SFX_OFFSET_WOOD, 0x843 }, { 0, 0x4854 }, { 0, 0x485A }, { 0, -0x4860 },