diff --git a/soh/soh/Enhancements/accessible-actors/AccessibleActorList.cpp b/soh/soh/Enhancements/accessible-actors/AccessibleActorList.cpp index a90199eab..cd526be28 100644 --- a/soh/soh/Enhancements/accessible-actors/AccessibleActorList.cpp +++ b/soh/soh/Enhancements/accessible-actors/AccessibleActorList.cpp @@ -371,6 +371,9 @@ void accessible_audio_compass_cleanup(AccessibleActor* actor) } void accessible_audio_compass(AccessibleActor* actor) { Player* player = GET_PLAYER(actor->play); + if (player->stateFlags1 & PLAYER_STATE1_TARGETING) + return; + actor->world.pos = player->actor.world.pos; actor->world.pos.z -= 50; bool shouldChime = false; diff --git a/soh/soh/Enhancements/accessible-actors/AccessibleAudioEngine.cpp b/soh/soh/Enhancements/accessible-actors/AccessibleAudioEngine.cpp index 4cb917c28..919992b66 100644 --- a/soh/soh/Enhancements/accessible-actors/AccessibleAudioEngine.cpp +++ b/soh/soh/Enhancements/accessible-actors/AccessibleAudioEngine.cpp @@ -68,7 +68,8 @@ static float lerp(float x, float y, float z) { //Pan the sound based on its projected position. float pan; //Use the game's panning mechanism, which returns a signed 8-bit integer between 0 (far-left) and 127 (far-right). -//It would appear that the correct thing to do is interpret this value as a gain factor in decibels. In practice, values below 38 or above 90 are never seen, so a sound that's panned far to one side or the other amounts to about -25DB worth of attenuation. +//It would appear that the correct thing to do is interpret this value as a gain factor in decibels. In practice, values below 38 or above 90 are never seen, so a sound that's panned far to one side or the other amounts to about -25DB worth of attenuation. + //Also: lie about the value of Z and give it a constant value to prevent weird behaviour when Z is far away. s8 panSigned = Audio_ComputeSoundPanSigned(extras->x, extras->z, 4); int db; if (panSigned < 64) diff --git a/soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp b/soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp index 4b4e58a62..d39146eae 100644 --- a/soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp +++ b/soh/soh/Enhancements/accessible-actors/ActorAccessibility.cpp @@ -133,7 +133,7 @@ void ActorAccessibility_Shutdown() { policy->pitch = 1.5; policy->runsAlways = false; policy->sound = sfx; - policy->volume = 0.5; + policy->volume = 1.0; policy->initUserData = NULL; policy->cleanupUserData = NULL; policy->pitchModifier = 0.1; diff --git a/soh/soh/Enhancements/accessible-actors/accessibility_cues.cpp b/soh/soh/Enhancements/accessible-actors/accessibility_cues.cpp index a3c796539..db758012d 100644 --- a/soh/soh/Enhancements/accessible-actors/accessibility_cues.cpp +++ b/soh/soh/Enhancements/accessible-actors/accessibility_cues.cpp @@ -13,7 +13,7 @@ void CollisionPoly_GetVertices(CollisionPoly* poly, Vec3s* vtxList, Vec3f* dest) #define MIN_INCLINE_DISTANCE 5.0 #define MIN_DECLINE_DISTANCE 5.0 #define DEFAULT_PROBE_SPEED 5.5 - +#define NOMINMAX static Player fakePlayer;//Used for wall height detection. static Vec3f D_80854798 = { 0.0f, 18.0f, 0.0f }; // From z_player.c. @@ -228,10 +228,17 @@ class Platform: protected TerrainCueSound { class Wall: protected TerrainCueSound { int frames; - + Vec3s probeRot; + f32 targetPitch; public: - Wall(AccessibleActor* actor, Vec3f pos) : TerrainCueSound(actor, pos) { + Wall(AccessibleActor* actor, Vec3f pos, Vec3s rot) : TerrainCueSound(actor, pos) { + probeRot = rot; currentPitch = 0.5; + + targetPitch = (f32) probeRot.y / (16384.0f * 2.0f); + if (probeRot.y != 0 && targetPitch < -0.4) + targetPitch = -0.4; + currentSFX = NA_SE_IT_SWORD_CHARGE; frames = 0; @@ -243,10 +250,20 @@ class Wall: protected TerrainCueSound { void run() { frames++; + if (frames == 20) { - frames = 0; - play(); - } + frames = 0; + play(); + ActorAccessibility_SeekSound(this, 0, 44100 * 2); + } + f32 pitchModifier; + + if (targetPitch < 0) + pitchModifier = LERP(2.5, 0.5 + targetPitch, (f32)frames / 20.0f); + else if (targetPitch > 0) + pitchModifier = LERP(0.1, (0.5 + targetPitch), (f32)frames / 20.0f); + + ActorAccessibility_SetSoundPitch(this, 0, pitchModifier); } }; class Spike : protected TerrainCueSound { @@ -416,7 +433,7 @@ class Ground : protected TerrainCueSound { destroyCurrentSound(); - new (&wall) Wall(actor, pos); + new (&wall) Wall(actor, pos, relRot); currentSound = (TerrainCueSound*)&wall; terrainDiscovered = DISCOVERED_WALL; }