blob: 7998d007214d5183cf2d872d52b0686a8b70c926 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include "nw4r/snd/snd_SoundHandle.h"
/* Original source:
* kiwi515/ogws
* src/nw4r/snd/snd_SoundHandle.cpp
*/
/*******************************************************************************
* headers
*/
#include "common.h" // nullptr
#include "nw4r/snd/snd_BasicSound.h"
#include "nw4r/NW4RAssert.hpp"
/*******************************************************************************
* functions
*/
namespace nw4r { namespace snd {
void SoundHandle::detail_AttachSoundAsTempHandle(detail::BasicSound* pSound) {
mSound = pSound;
if (pSound->IsAttachedTempGeneralHandle()) {
mSound->DetachTempGeneralHandle();
}
/*
if (mSound->IsAttachedTempSpecialHandle()) {
mSound->DetachTempSpecialHandle();
}
*/
mSound->mTempGeneralHandle = this;
}
void SoundHandle::detail_AttachSound(detail::BasicSound *sound)
{
NW4RAssertPointerNonnull_Line(81, sound);
mSound = sound;
if (sound->IsAttachedGeneralHandle())
mSound->DetachGeneralHandle();
mSound->mGeneralHandle = this;
}
void SoundHandle::DetachSound()
{
if (IsAttachedSound())
{
if (mSound->mGeneralHandle == this)
mSound->mGeneralHandle = nullptr;
if (mSound->mTempGeneralHandle == this)
mSound->mTempGeneralHandle = nullptr;
}
if (mSound)
mSound = nullptr;
}
}} // namespace nw4r::snd
|