diff --git a/bin/OpenLara.exe b/bin/OpenLara.exe index 2f46696..e99c925 100644 Binary files a/bin/OpenLara.exe and b/bin/OpenLara.exe differ diff --git a/src/lara.h b/src/lara.h index 2a37fe8..4a908ed 100644 --- a/src/lara.h +++ b/src/lara.h @@ -1365,7 +1365,7 @@ struct Lara : Character { int q = entityQuadrant(e); - if (q > -1 && e.isBlock() && e.y == y && alignToWall(-LARA_RADIUS, q, 64 + LARA_RADIUS, 512 - LARA_RADIUS)) { + if (q > -1 && e.isBlock() && e.y == y && alignToWall(-LARA_RADIUS, q, 64 + int(LARA_RADIUS), 512 - int(LARA_RADIUS))) { Block *block = (Block*)e.controller; block->angle.y = angle.y; block->updateEntity(); diff --git a/src/level.h b/src/level.h index c0020bc..994eb3a 100644 --- a/src/level.h +++ b/src/level.h @@ -745,7 +745,7 @@ struct Level : IGame { initReflections(); for (int i = 0; i < level.soundSourcesCount; i++) { TR::SoundSource &src = level.soundSources[i]; - lara->playSound(src.id, vec3(float(src.x), float(src.y), float(src.z)), Sound::PAN | Sound::LOOP); + lara->playSound(src.id, vec3(float(src.x), float(src.y), float(src.z)), Sound::PAN | Sound::LOOP | Sound::STATIC); } } diff --git a/src/sound.h b/src/sound.h index 26fc6c8..3c20cdf 100644 --- a/src/sound.h +++ b/src/sound.h @@ -20,7 +20,7 @@ #include "libs/stb_vorbis/stb_vorbis.c" #endif -#define SND_CHANNELS_MAX 32 +#define SND_CHANNELS_MAX 128 #define SND_FADEOFF_DIST (1024.0f * 8.0f) namespace Sound { @@ -311,6 +311,7 @@ namespace Sound { UNIQUE = 4, REPLAY = 8, SYNC = 16, + STATIC = 32, }; struct Sample { @@ -450,7 +451,12 @@ namespace Sound { Frame *buffer = new Frame[bufSize]; // + 50% for pitch for (int i = 0; i < channelsCount; i++) { - + if (channels[i]->flags & STATIC) { + vec3 d = channels[i]->pos - listener.matrix.getPos(); + if (fabsf(d.x) > SND_FADEOFF_DIST || fabsf(d.y) > SND_FADEOFF_DIST || fabsf(d.z) > SND_FADEOFF_DIST) + continue; + } + memset(buffer, 0, sizeof(Frame) * bufSize); channels[i]->render(buffer, int(count * channels[i]->pitch));