Revisión | 2d0323631c85c0d3be5385b43fe5be76bddf0728 (tree) |
---|---|
Tiempo | 2012-09-23 14:54:02 |
Autor | h2so5 <h2so5@git....> |
Commiter | h2so5 |
Merge branch 'master' of git.sourceforge.jp:/gitroot/mmo/main
@@ -241,10 +241,10 @@ Handle<Value> Card::Function_Music_stopBGM(const Arguments& args) | ||
241 | 241 | { |
242 | 242 | |
243 | 243 | if (args.Length() == 1 && args[0]->IsBoolean()) { |
244 | - auto fade = args[1]->ToBoolean()->BooleanValue(); | |
244 | + auto fade = args[0]->ToBoolean()->BooleanValue(); | |
245 | 245 | ResourceManager::music()->Stop(fade); |
246 | 246 | }else if(args.Length() == 0) { |
247 | - ResourceManager::music()->Stop(false); | |
247 | + ResourceManager::music()->Stop(true); | |
248 | 248 | } |
249 | 249 | |
250 | 250 | return Undefined(); |
@@ -9,15 +9,16 @@ | ||
9 | 9 | |
10 | 10 | extern int LoadFile(const TCHAR *FilePath, void **FileImageAddr, int *FileSize); |
11 | 11 | |
12 | + | |
12 | 13 | Music::Music() : |
13 | 14 | bgm_handle_(), |
14 | 15 | se_handle_(), |
15 | -prev_bgm_(-1), | |
16 | -present_bgm_(-1), | |
17 | -requested_bgm_(-1), | |
18 | -music_paths_(), | |
19 | 16 | crossfade_now_(false), |
20 | -fade_count_(0) | |
17 | +fade_out_(false), | |
18 | +fade_count_(-1), | |
19 | +present_bgm_(-1), | |
20 | +prev_bgm_(-1), | |
21 | +requested_bgm_(-1) | |
21 | 22 | { |
22 | 23 | } |
23 | 24 |
@@ -137,8 +138,16 @@ void Music::Stop(bool fadeout) | ||
137 | 138 | { |
138 | 139 | StopSoundMem(present_bgm_); |
139 | 140 | } |
140 | - crossfade_now_ = fadeout; | |
141 | + if(crossfade_now_) | |
142 | + { | |
143 | + StopSoundMem(present_bgm_); | |
144 | + present_bgm_ = requested_bgm_; | |
145 | + } | |
146 | + crossfade_now_ = false; | |
147 | + fade_out_ = fadeout; | |
148 | + fadeout_count_ = GetVolumeSoundMem(present_bgm_); | |
141 | 149 | fade_count_ = 0; |
150 | + requested_bgm_ = -1; | |
142 | 151 | } |
143 | 152 | |
144 | 153 | void Music::PlaySE(tstring name) |
@@ -176,10 +185,12 @@ void Music::Update() | ||
176 | 185 | crossfade_now_ = true; |
177 | 186 | } |
178 | 187 | } |
179 | - if(!crossfade_now_)return; | |
180 | - if(CheckHandleASyncLoad(requested_bgm_) == false && requested_bgm_ != -1) | |
188 | + if(CheckHandleASyncLoad(requested_bgm_) == false && requested_bgm_ != -1 && crossfade_now_) | |
181 | 189 | { |
182 | 190 | if(fade_count_ == 0)PlaySoundMem(requested_bgm_,DX_PLAYTYPE_LOOP); |
191 | + ChangeVolumeSoundMem((int)((90.0-(double)fade_count_)/0.9),present_bgm_); | |
192 | + ChangeVolumeSoundMem((int)((double)fade_count_/0.9),requested_bgm_); | |
193 | + ++fade_count_; | |
183 | 194 | if(fade_count_ >= 90) |
184 | 195 | { |
185 | 196 | ChangeVolumeSoundMem(100,requested_bgm_); |
@@ -190,9 +201,20 @@ void Music::Update() | ||
190 | 201 | fade_count_ = 0; |
191 | 202 | crossfade_now_ = false; |
192 | 203 | } |
193 | - ChangeVolumeSoundMem((int)((double)fade_count_/0.9),requested_bgm_); | |
194 | - ChangeVolumeSoundMem((int)((90.0-(double)fade_count_)/0.9),present_bgm_); | |
195 | - ++fade_count_; | |
204 | + } | |
205 | + if(fade_out_ == true) | |
206 | + { | |
207 | + if(fadeout_count_ >= 90) | |
208 | + { | |
209 | + StopSoundMem(present_bgm_); | |
210 | + ChangeVolumeSoundMem(100,present_bgm_); | |
211 | + present_bgm_ = -1; | |
212 | + fadeout_count_ = 0; | |
213 | + fade_out_ = false; | |
214 | + requested_bgm_ = -1; | |
215 | + } | |
216 | + ChangeVolumeSoundMem((int)((90.0-(double)fadeout_count_)/0.9),present_bgm_); | |
217 | + ++fadeout_count_; | |
196 | 218 | } |
197 | 219 | } |
198 | 220 |
@@ -30,7 +30,9 @@ public: | ||
30 | 30 | |
31 | 31 | private: |
32 | 32 | bool crossfade_now_; |
33 | + bool fade_out_; | |
33 | 34 | int fade_count_; |
35 | + int fadeout_count_; | |
34 | 36 | int present_bgm_; |
35 | 37 | int prev_bgm_; |
36 | 38 | int requested_bgm_; |
@@ -2,7 +2,7 @@ | ||
2 | 2 | /***MetaData*** |
3 | 3 | |
4 | 4 | { |
5 | - "name": "BGMリスト", | |
5 | + "name": "BGM繝ェ繧ケ繝?, | |
6 | 6 | "icon": "icon.png", |
7 | 7 | "api_version": 1 |
8 | 8 | } |
@@ -17,7 +17,6 @@ list = new UI.List({ | ||
17 | 17 | Music.onReload = function () { |
18 | 18 | |
19 | 19 | list.clearItems(); |
20 | - | |
21 | 20 | var even_line = false; |
22 | 21 | var music_names = Music.all(); |
23 | 22 | for (var i = 0; i < music_names.length; i++) { |
@@ -33,7 +32,17 @@ Music.onReload = function () { | ||
33 | 32 | }) |
34 | 33 | ); |
35 | 34 | })(music_names[i]) |
36 | - } | |
35 | +} | |
36 | + list.addItem( | |
37 | + new UI.Label({ | |
38 | + docking: UI.DOCKING_TOP | UI.DOCKING_LEFT | UI.DOCKING_RIGHT, | |
39 | + text: "蜀咲函蛛懈ュ「", | |
40 | + bgcolor: ((even_line = !even_line) ? "#EEAFEECC" : "#FFFFFFCC"), | |
41 | + onclick: function () { | |
42 | + Music.stop(true) | |
43 | + } | |
44 | + }) | |
45 | + ); | |
37 | 46 | } |
38 | 47 | |
39 | 48 | Music.onReload(); |