mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Mark entities as missing until they are received
This fixes a bug where the plane sound in t1l1 would stop immediately because the entity isn't received at this point
This commit is contained in:
parent
bed9bbbd05
commit
010a5ffc74
2 changed files with 13 additions and 2 deletions
|
@ -143,6 +143,8 @@ enum channel_flags_t {
|
|||
CHANNEL_FLAG_NO_ENTITY = 32,
|
||||
CHANNEL_FLAG_PAUSED = 64,
|
||||
CHANNEL_FLAG_LOOPING = 128,
|
||||
// Added in OPM
|
||||
CHANNEL_FLAG_MISSING_ENT = 256,
|
||||
};
|
||||
|
||||
enum sfx_flags_t {
|
||||
|
|
|
@ -1387,6 +1387,13 @@ static void S_OPENAL_Start2DSound(
|
|||
if (bSupportWaitTillSoundDone) {
|
||||
pChannel->iTime = 0;
|
||||
}
|
||||
|
||||
if (s_entity[iEntNum].time < pChannel->iTime) {
|
||||
// Fixed in OPM
|
||||
// Not sure if it's the real solution, but script_origin entities are usually
|
||||
// never sent to client so the sound will immediately get stopped
|
||||
pChannel->iFlags |= CHANNEL_FLAG_MISSING_ENT;
|
||||
}
|
||||
} else {
|
||||
VectorClear(pChannel->vOrigin);
|
||||
pChannel->iTime = 0;
|
||||
|
@ -1573,7 +1580,7 @@ void S_OPENAL_StartSound(
|
|||
// Fixed in OPM
|
||||
// Not sure if it's the real solution, but script_origin entities are usually
|
||||
// never sent to client so the sound will immediately get stopped
|
||||
pChannel->iFlags |= CHANNEL_FLAG_NO_ENTITY;
|
||||
pChannel->iFlags |= CHANNEL_FLAG_MISSING_ENT;
|
||||
}
|
||||
} else {
|
||||
VectorClear(pChannel->vOrigin);
|
||||
|
@ -2346,11 +2353,13 @@ void S_OPENAL_Respatialize(int iEntNum, const vec3_t vHeadPos, const vec3_t vAxi
|
|||
} else {
|
||||
if (s_entity[pChannel->iEntNum].time < pChannel->iTime) {
|
||||
VectorCopy(pChannel->vOrigin, vOrigin);
|
||||
if (!(pChannel->iFlags & CHANNEL_FLAG_LOOPING)) {
|
||||
if (!(pChannel->iFlags & CHANNEL_FLAG_LOOPING) && !(pChannel->iFlags & (CHANNEL_FLAG_MISSING_ENT))) {
|
||||
pChannel->end_sample();
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
pChannel->iFlags &= ~CHANNEL_FLAG_MISSING_ENT;
|
||||
|
||||
VectorCopy(s_entity[pChannel->iEntNum].position, vEntOrigin);
|
||||
VectorCopy(vEntOrigin, vOrigin);
|
||||
VectorCopy(vOrigin, pChannel->vOrigin);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue