@@ -54,35 +54,14 @@ ScreenNetSelectMusic::Init()
54
54
{
55
55
ScreenSelectMusic::Init ();
56
56
GAMESTATE->m_bPlayingMulti = true ;
57
- SAMPLE_MUSIC_PREVIEW_MODE.Load (m_sName, " SampleMusicPreviewMode" );
58
- MUSIC_WHEEL_TYPE.Load (m_sName, " MusicWheelType" );
59
-
60
- // todo: handle me theme-side -aj
61
- FOREACH_EnabledPlayer (p)
62
- {
63
- m_ModIconRow[p].SetName (ssprintf (" ModIconsP%d" , p + 1 ));
64
- m_ModIconRow[p].Load (" ModIconRowSelectMusic" , p);
65
- m_ModIconRow[p].SetFromGameState ();
66
- LOAD_ALL_COMMANDS_AND_SET_XY (m_ModIconRow[p]);
67
- this ->AddChild (&m_ModIconRow[p]);
68
- }
69
-
70
57
// Load SFX and music
71
58
m_soundChangeOpt.Load (THEME->GetPathS (m_sName, " change opt" ));
72
59
m_soundChangeSel.Load (THEME->GetPathS (m_sName, " change sel" ));
73
- m_sSectionMusicPath = THEME->GetPathS (m_sName, " section music" );
74
- m_sRouletteMusicPath = THEME->GetPathS (m_sName, " roulette music" );
75
- m_sRandomMusicPath = THEME->GetPathS (m_sName, " random music" );
76
60
77
61
NSMAN->OnMusicSelect ();
78
62
79
63
m_bInitialSelect = false ;
80
64
m_bAllowInput = NSMAN->IsETTP ();
81
-
82
- SAMPLE_MUSIC_FALLBACK_FADE_IN_SECONDS.Load (
83
- m_sName, " SampleMusicFallbackFadeInSeconds" );
84
- SAMPLE_MUSIC_FADE_OUT_SECONDS.Load (m_sName, " SampleMusicFadeOutSeconds" );
85
- ALIGN_MUSIC_BEATS.Load (m_sName, " AlignMusicBeat" );
86
65
}
87
66
88
67
void
@@ -113,133 +92,38 @@ ScreenNetSelectMusic::Input(const InputEventPlus& input)
113
92
if (input.type != IET_FIRST_PRESS && input.type != IET_REPEAT)
114
93
return false ;
115
94
116
- bool bHoldingCtrl =
117
- INPUTFILTER->IsBeingPressed (DeviceInput (DEVICE_KEYBOARD, KEY_LCTRL)) ||
118
- INPUTFILTER->IsBeingPressed (DeviceInput (DEVICE_KEYBOARD, KEY_RCTRL)) ||
119
- (!NSMAN->useSMserver ); // If we are disconnected, assume no chatting
120
-
121
- bool holding_shift =
122
- INPUTFILTER->IsBeingPressed (DeviceInput (DEVICE_KEYBOARD, KEY_LSHIFT)) ||
123
- INPUTFILTER->IsBeingPressed (DeviceInput (DEVICE_KEYBOARD, KEY_RSHIFT));
124
-
125
- wchar_t c = INPUTMAN->DeviceInputToChar (input.DeviceI , false );
126
- MakeUpper (&c, 1 );
127
-
128
- bool handled = false ;
129
-
130
- /* I'm commenting this here and adding the 2 ctrl+key and the ctrl+shift+key
131
- inputs
132
- // Ctrl+[A-Z] to go to that letter of the alphabet
133
- if( bHoldingCtrl && ( c >= 'A' ) && ( c <= 'Z' ) )
134
- {
135
- SortOrder so = GAMESTATE->m_SortOrder;
136
- if( ( so != SORT_TITLE ) && ( so != SORT_ARTIST ) )
137
- {
138
- so = SORT_TITLE;
139
-
140
- GAMESTATE->m_PreferredSortOrder = so;
141
- GAMESTATE->m_SortOrder.Set( so );
142
- // Odd, changing the sort order requires us to call SetOpenSection
143
- more than once m_MusicWheel.ChangeSort( so ); m_MusicWheel.SetOpenSection(
144
- ssprintf("%c", c ) );
145
- }
146
- m_MusicWheel.SelectSection( ssprintf("%c", c ) );
147
- m_MusicWheel.ChangeSort( so );
148
- m_MusicWheel.SetOpenSection( ssprintf("%c", c ) );
149
- m_MusicWheel.Move(+1);
150
- handled = true;
151
- }
152
- */
153
- if (holding_shift && bHoldingCtrl && input.type == IET_FIRST_PRESS &&
154
- m_MusicWheel.IsSettled ()) {
155
- if (c == ' R' ) {
156
- // Reload the currently selected song. -Kyz
157
- Song* to_reload = m_MusicWheel.GetSelectedSong ();
158
- if (to_reload != nullptr ) {
159
- to_reload->ReloadFromSongDir ();
160
- this ->AfterMusicChange ();
161
- handled = true ;
162
- }
163
- } else if (c == ' F' ) {
164
- // Favorite the currently selected song. -Not Kyz
165
- Song* fav_me_biatch = m_MusicWheel.GetSelectedSong ();
166
- if (fav_me_biatch) {
167
- Profile* pProfile = PROFILEMAN->GetProfile (PLAYER_1);
168
-
169
- if (!fav_me_biatch->IsFavorited ()) {
170
- fav_me_biatch->SetFavorited (true );
171
- pProfile->AddToFavorites (
172
- GAMESTATE->m_pCurSteps [PLAYER_1]->GetChartKey ());
173
- } else {
174
- fav_me_biatch->SetFavorited (false );
175
- pProfile->RemoveFromFavorites (
176
- GAMESTATE->m_pCurSteps [PLAYER_1]->GetChartKey ());
177
- }
178
- Message msg (" FavoritesUpdated" );
179
- MESSAGEMAN->Broadcast (msg);
180
- m_MusicWheel.ChangeMusic (0 );
181
- return true ;
182
- }
183
- } else if (c == ' M' ) {
184
- // PermaMirror the currently selected song. -Not Kyz
185
- Song* alwaysmirrorsmh = m_MusicWheel.GetSelectedSong ();
186
- if (alwaysmirrorsmh) {
187
- Profile* pProfile = PROFILEMAN->GetProfile (PLAYER_1);
188
-
189
- if (!alwaysmirrorsmh->IsPermaMirror ()) {
190
- alwaysmirrorsmh->SetPermaMirror (true );
191
- pProfile->AddToPermaMirror (
192
- GAMESTATE->m_pCurSteps [PLAYER_1]->GetChartKey ());
193
- } else {
194
- alwaysmirrorsmh->SetPermaMirror (false );
195
- pProfile->RemoveFromPermaMirror (
196
- GAMESTATE->m_pCurSteps [PLAYER_1]->GetChartKey ());
197
- }
198
- Message msg (" FavoritesUpdated" );
199
- MESSAGEMAN->Broadcast (msg);
200
- m_MusicWheel.ChangeMusic (0 );
201
- return true ;
202
- }
203
- } else if (c == ' G' ) {
204
- Profile* pProfile = PROFILEMAN->GetProfile (PLAYER_1);
205
- pProfile->AddGoal (GAMESTATE->m_pCurSteps [PLAYER_1]->GetChartKey ());
206
- Song* asonglol = m_MusicWheel.GetSelectedSong ();
207
- asonglol->SetHasGoal (true );
208
- MESSAGEMAN->Broadcast (" FavoritesUpdated" );
209
- m_MusicWheel.ChangeMusic (0 );
210
- return true ;
211
- } else if (c == ' Q' ) {
212
- DifferentialReload ();
213
- return true ;
214
- } else if (c == ' S' ) {
215
- PROFILEMAN->SaveProfile (PLAYER_1);
216
- SCREENMAN->SystemMessage (" Profile Saved" );
217
- return true ;
218
- } else if (input.DeviceI .device == DEVICE_KEYBOARD &&
219
- input.DeviceI .button == KEY_BACK) {
220
- // Keyboard shortcut to delete a song from disk (ctrl + backspace)
221
- Song* songToDelete = m_MusicWheel.GetSelectedSong ();
222
- if (songToDelete && PREFSMAN->m_bAllowSongDeletion .Get ()) {
223
- m_pSongAwaitingDeletionConfirmation = songToDelete;
224
- ScreenPrompt::Prompt (
225
- SM_ConfirmDeleteSong,
226
- ssprintf (PERMANENTLY_DELETE.GetValue (),
227
- songToDelete->m_sMainTitle .c_str (),
228
- songToDelete->GetSongDir ().c_str ()),
229
- PROMPT_YES_NO);
230
- return true ;
231
- }
232
- }
233
- }
234
- return ScreenSelectMusic::Input (input) || handled;
95
+ return ScreenSelectMusic::Input (input);
235
96
}
236
97
237
98
void
238
99
ScreenNetSelectMusic::HandleScreenMessage (const ScreenMessage SM)
239
100
{
240
- if (SM == SM_GoToNextScreen)
101
+ if (SM == SM_GoToNextScreen) {
241
102
SOUND->StopMusic ();
242
- else if (SM == SM_UsersUpdate) {
103
+ if (NSMAN->song != nullptr ) {
104
+ GAMESTATE->m_pCurSong .Set (NSMAN->song );
105
+ if (NSMAN->steps != nullptr ) {
106
+ GAMESTATE->m_pCurSteps [PLAYER_1].Set (NSMAN->steps );
107
+ GAMESTATE->m_PreferredDifficulty [PLAYER_1].Set (
108
+ NSMAN->steps ->GetDifficulty ());
109
+ }
110
+ if (!m_MusicWheel.SelectSong (NSMAN->song )) {
111
+ m_MusicWheel.ChangeSort (SORT_GROUP);
112
+ m_MusicWheel.FinishTweening ();
113
+ SCREENMAN->PostMessageToTopScreen (SM_SetWheelSong, 0 .710f );
114
+ m_MusicWheel.SelectSong (NSMAN->song );
115
+ }
116
+ if (NSMAN->rate > 0 ) {
117
+ GAMESTATE->m_SongOptions .GetPreferred ().m_fMusicRate =
118
+ NSMAN->rate / 1000 .f ;
119
+ MESSAGEMAN->Broadcast (" RateChanged" );
120
+ }
121
+ m_MusicWheel.Select ();
122
+ m_MusicWheel.Move (-1 );
123
+ m_MusicWheel.Move (1 );
124
+ m_MusicWheel.Move (0 );
125
+ }
126
+ } else if (SM == SM_UsersUpdate) {
243
127
MESSAGEMAN->Broadcast (" UsersUpdate" );
244
128
} else if (SM == SM_FriendsUpdate) {
245
129
MESSAGEMAN->Broadcast (" FriendsUpdate" );
@@ -261,10 +145,6 @@ ScreenNetSelectMusic::HandleScreenMessage(const ScreenMessage SM)
261
145
m_MusicWheel.Move (0 );
262
146
} else if (SM == SM_NoSongs) {
263
147
SCREENMAN->SetNewScreen (THEME->GetMetric (m_sName, " NoSongsScreen" ));
264
- } else if (SM == SM_SetWheelSong) // After we've done the sort on wheel,
265
- // select song.
266
- {
267
- m_MusicWheel.SelectSong (m_cSong);
268
148
} else if (SM == SM_RefreshWheelLocation) {
269
149
m_MusicWheel.Select ();
270
150
m_MusicWheel.Move (-1 );
@@ -275,9 +155,6 @@ ScreenNetSelectMusic::HandleScreenMessage(const ScreenMessage SM)
275
155
GAMESTATE->m_EditMode = EditMode_Invalid;
276
156
// XXX HACK: This will cause ScreenSelectOptions to go back here.
277
157
NSMAN->OffOptions ();
278
-
279
- // Update changes
280
- FOREACH_EnabledPlayer (p) m_ModIconRow[p].SetFromGameState ();
281
158
} else if (SM == SM_SongChanged) {
282
159
if (m_MusicWheel.GetNumItems () > 0 ) {
283
160
GAMESTATE->m_pCurSong .Set (m_MusicWheel.GetSelectedSong ());
@@ -287,7 +164,6 @@ ScreenNetSelectMusic::HandleScreenMessage(const ScreenMessage SM)
287
164
if (NSMAN->song != nullptr ) {
288
165
GAMESTATE->m_pCurSong .Set (NSMAN->song );
289
166
if (NSMAN->steps != nullptr ) {
290
- m_vpSteps[m_iSelection[PLAYER_1]] = NSMAN->steps ;
291
167
GAMESTATE->m_pCurSteps [PLAYER_1].Set (NSMAN->steps );
292
168
GAMESTATE->m_PreferredDifficulty [PLAYER_1].Set (
293
169
NSMAN->steps ->GetDifficulty ());
@@ -313,7 +189,6 @@ ScreenNetSelectMusic::HandleScreenMessage(const ScreenMessage SM)
313
189
if (NSMAN->song != nullptr ) {
314
190
GAMESTATE->m_pCurSong .Set (NSMAN->song );
315
191
if (NSMAN->steps != nullptr ) {
316
- m_vpSteps[m_iSelection[PLAYER_1]] = NSMAN->steps ;
317
192
GAMESTATE->m_pCurSteps [PLAYER_1].Set (NSMAN->steps );
318
193
GAMESTATE->m_PreferredDifficulty [PLAYER_1].Set (
319
194
NSMAN->steps ->GetDifficulty ());
@@ -382,6 +257,12 @@ ScreenNetSelectMusic::LeftAndRightPressed(const PlayerNumber pn)
382
257
INPUTMAPPER->IsBeingPressed (GAME_BUTTON_RIGHT, pn);
383
258
}
384
259
260
+ ScreenNetSelectMusic::~ScreenNetSelectMusic ()
261
+ {
262
+ if (PREFSMAN->m_verbose_log > 1 )
263
+ LOG->Trace (" ScreenNetSelectMusic::~ScreenNetSelectMusic()" );
264
+ }
265
+
385
266
bool
386
267
ScreenNetSelectMusic::MenuLeft (const InputEventPlus& input)
387
268
{
@@ -441,7 +322,8 @@ ScreenNetSelectMusic::SelectCurrent()
441
322
442
323
if (pSong == NULL )
443
324
return false ;
444
-
325
+ if (m_vpSteps.size () <= m_iSelection[PLAYER_1])
326
+ return false ;
445
327
GAMESTATE->m_pCurSong .Set (pSong);
446
328
Steps* pSteps = m_vpSteps[m_iSelection[PLAYER_1]];
447
329
GAMESTATE->m_pCurSteps [PLAYER_1].Set (pSteps);
@@ -478,19 +360,8 @@ ScreenNetSelectMusic::TweenOffScreen()
478
360
void
479
361
ScreenNetSelectMusic::StartSelectedSong ()
480
362
{
481
- Song* pSong = m_MusicWheel.GetSelectedSong ();
482
- GAMESTATE->m_pCurSong .Set (pSong);
483
- FOREACH_EnabledPlayer (pn)
484
- {
485
- StepsType st = GAMESTATE->GetCurrentStyle (pn)
486
- ->m_StepsType ; // StepsType_dance_single;
487
- Steps* pSteps = m_vpSteps[m_iSelection[PLAYER_1]];
488
- GAMESTATE->m_PreferredDifficulty [pn].Set (pSteps->GetDifficulty ());
489
- GAMESTATE->m_pCurSteps [pn].Set (pSteps);
490
- }
491
-
492
363
GAMESTATE->m_PreferredSortOrder = GAMESTATE->m_SortOrder ;
493
- GAMESTATE->m_pPreferredSong = pSong ;
364
+ GAMESTATE->m_pPreferredSong = GAMESTATE-> m_pCurSong ;
494
365
495
366
// force event mode
496
367
GAMESTATE->m_bTemporaryEventMode = true ;
@@ -499,32 +370,6 @@ ScreenNetSelectMusic::StartSelectedSong()
499
370
StartTransitioningScreen (SM_GoToNextScreen);
500
371
}
501
372
502
- /*
503
- void
504
- ScreenNetSelectMusic::UpdateDifficulties(PlayerNumber pn)
505
- {
506
- if (GAMESTATE->m_pCurSong == NULL) {
507
- m_StepsDisplays[pn].SetFromStepsTypeAndMeterAndDifficultyAndCourseType(
508
- StepsType_Invalid, 0, Difficulty_Beginner);
509
- // m_DifficultyIcon[pn].SetFromSteps( pn, NULL ); // It will blank it
510
- // out
511
- return;
512
- }
513
-
514
- StepsType st = GAMESTATE->GetCurrentStyle(pn)->m_StepsType;
515
-
516
- Steps* pSteps =
517
- SongUtil::GetStepsByDifficulty(GAMESTATE->m_pCurSong, st, m_DC[pn]);
518
- GAMESTATE->m_pCurSteps[pn].Set(pSteps);
519
-
520
- if ((m_DC[pn] < NUM_Difficulty) && (m_DC[pn] >= Difficulty_Beginner))
521
- m_StepsDisplays[pn].SetFromSteps(pSteps);
522
- else
523
- m_StepsDisplays[pn].SetFromStepsTypeAndMeterAndDifficultyAndCourseType(
524
- StepsType_Invalid, 0, Difficulty_Beginner);
525
- }
526
- */
527
-
528
373
void
529
374
ScreenNetSelectMusic::BeginScreen ()
530
375
{
0 commit comments