|
2 | 2 | // |
3 | 3 | ////////////////////////////////////////////////////////////////////// |
4 | 4 |
|
5 | | -#include "stdafx.h" |
6 | 5 | #include "MusicStream.h" |
| 6 | +#include "stdafx.h" |
7 | 7 | #include "xr_streamsnd.h" |
8 | 8 |
|
9 | | -#include "x_ray.h" |
10 | 9 | #include "GameFont.h" |
| 10 | +#include "x_ray.h" |
11 | 11 |
|
12 | 12 | ////////////////////////////////////////////////////////////////////// |
13 | 13 | // Construction/Destruction |
14 | 14 | ////////////////////////////////////////////////////////////////////// |
15 | 15 |
|
16 | 16 | CMusicStream::CMusicStream() |
17 | 17 | { |
18 | | - |
19 | 18 | } |
20 | 19 |
|
21 | 20 | CMusicStream::~CMusicStream() |
22 | 21 | { |
23 | | - |
24 | 22 | } |
25 | 23 |
|
26 | 24 | int CMusicStream::FindEmptySlot() |
27 | 25 | { |
28 | | - for (u32 i=0; i<streams.size(); i++) { |
29 | | - if (streams[i]==0) return i; |
30 | | - } |
31 | | - return -1; |
| 26 | + for (u32 i = 0; i < streams.size(); i++) |
| 27 | + { |
| 28 | + if (streams[i] == 0) return i; |
| 29 | + } |
| 30 | + return -1; |
32 | 31 | } |
33 | 32 |
|
34 | | -CSoundStream* CMusicStream::CreateSound (LPCSTR name ) |
| 33 | +CSoundStream* CMusicStream::CreateSound(LPCSTR name) |
35 | 34 | { |
36 | | - int slot; |
37 | | - CSoundStream *pSnd = xr_new<CSoundStream> (); |
38 | | - pSnd->Load(name); |
| 35 | + int slot; |
| 36 | + CSoundStream* pSnd = xr_new<CSoundStream>(); |
| 37 | + pSnd->Load(name); |
39 | 38 |
|
40 | | - if ((slot=FindEmptySlot())>=0){ |
41 | | - streams[slot] = pSnd; |
42 | | - return pSnd; |
43 | | - } |
| 39 | + if ((slot = FindEmptySlot()) >= 0) { |
| 40 | + streams[slot] = pSnd; |
| 41 | + return pSnd; |
| 42 | + } |
44 | 43 |
|
45 | | - streams.push_back(pSnd); |
46 | | - return pSnd; |
| 44 | + streams.push_back(pSnd); |
| 45 | + return pSnd; |
47 | 46 | } |
48 | 47 |
|
49 | | -void CMusicStream::DeleteSound (CSoundStream* pSnd) |
| 48 | +void CMusicStream::DeleteSound(CSoundStream* pSnd) |
50 | 49 | { |
51 | | - int slot=-1; |
52 | | - for (u32 i=0; i<streams.size(); i++){ |
53 | | - if (streams[i]==pSnd) { slot = i; break; } |
54 | | - } |
55 | | - |
56 | | - if (slot>=0){ |
57 | | - xr_delete(streams[slot]); |
58 | | - pSnd = NULL; |
59 | | - } |
| 50 | + int slot = -1; |
| 51 | + for (u32 i = 0; i < streams.size(); i++) |
| 52 | + { |
| 53 | + if (streams[i] == pSnd) { |
| 54 | + slot = i; |
| 55 | + break; |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + if (slot >= 0) { |
| 60 | + xr_delete(streams[slot]); |
| 61 | + pSnd = NULL; |
| 62 | + } |
60 | 63 | } |
61 | 64 |
|
62 | 65 | void CMusicStream::OnMove() |
63 | 66 | { |
64 | | - for(u32 i=0; i<streams.size(); i++) streams[i]->OnMove(); |
65 | | -/* if (psDeviceFlags&rsStatistic) |
66 | | - { |
67 | | - int cnt = 0; |
68 | | - for(int i=0; i<streams.size(); i++) cnt+=streams[i]->isPlaying()?1:0; |
69 | | - pApp->pFont->Out(0,0.5f,"%d / %d",cnt,streams.size()); |
70 | | - } |
71 | | -*/ |
| 67 | + for (u32 i = 0; i < streams.size(); i++) |
| 68 | + streams[i]->OnMove(); |
| 69 | + /* if (psDeviceFlags&rsStatistic) |
| 70 | + { |
| 71 | + int cnt = 0; |
| 72 | + for(int i=0; i<streams.size(); i++) cnt+=streams[i]->isPlaying()?1:0; |
| 73 | + pApp->pFont->Out(0,0.5f,"%d / %d",cnt,streams.size()); |
| 74 | + } |
| 75 | + */ |
72 | 76 | } |
73 | 77 |
|
74 | 78 | void CMusicStream::Reload() |
75 | 79 | { |
76 | | - // ... |
| 80 | + // ... |
77 | 81 | } |
78 | 82 |
|
79 | 83 | void CMusicStream::Update() |
80 | 84 | { |
81 | | - for (u32 i=0; i<streams.size(); i++) |
82 | | - if (streams[i]) streams[i]->bNeedUpdate=true; |
| 85 | + for (u32 i = 0; i < streams.size(); i++) |
| 86 | + if (streams[i]) streams[i]->bNeedUpdate = true; |
83 | 87 | } |
0 commit comments