mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-25 23:55:20 -07:00
Walls now sound different depending on which direction the probe was going when it found them. Also no compass chime while Z-targeting.
This commit is contained in:
parent
73acaa3861
commit
954f3fb607
4 changed files with 30 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -69,6 +69,7 @@ static float lerp(float x, float y, float z) {
|
|||
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.
|
||||
//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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue