mirror of
https://github.com/XProger/OpenLara.git
synced 2025-01-17 21:09:00 +01:00
#9 fix static sounds (no free channels message)
This commit is contained in:
parent
d56c2ecab6
commit
299a6f4f52
BIN
bin/OpenLara.exe
BIN
bin/OpenLara.exe
Binary file not shown.
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
10
src/sound.h
10
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));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user