2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-08-27 03:59:22 +00:00
|
|
|
Class: ScreenPlayerOptions
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
Desc: Select a song.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-08-27 03:59:22 +00:00
|
|
|
Chris Danford
|
2002-05-20 08:59:37 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ScreenPlayerOptions.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "RageLog.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "GameState.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
2003-02-17 12:19:42 +00:00
|
|
|
#include "NoteSkinManager.h"
|
2003-04-18 02:13:23 +00:00
|
|
|
#include "NoteFieldPositioning.h"
|
2003-04-21 22:36:45 +00:00
|
|
|
#include "ScreenSongOptions.h"
|
2003-06-15 17:05:51 +00:00
|
|
|
#include "Notes.h"
|
|
|
|
|
#include "Course.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-04-16 22:49:40 +00:00
|
|
|
#define PREV_SCREEN( play_mode ) THEME->GetMetric ("ScreenPlayerOptions","PrevScreen"+Capitalize(PlayModeToString(play_mode)))
|
|
|
|
|
#define NEXT_SCREEN( play_mode ) THEME->GetMetric ("ScreenPlayerOptions","NextScreen"+Capitalize(PlayModeToString(play_mode)))
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
PO_SPEED = 0,
|
2003-01-25 11:05:12 +00:00
|
|
|
PO_ACCEL,
|
2002-05-20 08:59:37 +00:00
|
|
|
PO_APPEAR,
|
|
|
|
|
PO_TURN,
|
|
|
|
|
PO_SCROLL,
|
2002-05-27 08:23:27 +00:00
|
|
|
PO_HOLD_NOTES,
|
2003-04-24 06:16:04 +00:00
|
|
|
PO_DARK,
|
2003-06-15 17:05:51 +00:00
|
|
|
PO_STEP,
|
2002-05-20 08:59:37 +00:00
|
|
|
NUM_PLAYER_OPTIONS_LINES
|
|
|
|
|
};
|
2003-03-15 19:25:37 +00:00
|
|
|
OptionRow g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = {
|
2003-04-24 06:16:04 +00:00
|
|
|
OptionRow( "Speed", "x0.25","x0.5","x0.75","x1","x1.5","x2","x3","x5","x8","C200","C300" ),
|
2003-04-01 19:31:27 +00:00
|
|
|
OptionRow( "Acceler\n-ation", "OFF","BOOST","BRAKE","WAVE","EXPAND","BOOMERANG" ),
|
2003-05-04 13:58:45 +00:00
|
|
|
OptionRow( "Appear\n-ance", "VISIBLE","HIDDEN","SUDDEN","STEALTH","BLINK", "R.VANISH" ),
|
2003-05-05 06:48:20 +00:00
|
|
|
OptionRow( "Turn", "OFF","MIRROR","LEFT","RIGHT","SHUFFLE","S.SHUFFLE" ),
|
2003-03-15 19:25:37 +00:00
|
|
|
OptionRow( "Scroll", "STANDARD","REVERSE" ),
|
|
|
|
|
OptionRow( "Holds", "OFF","ON" ),
|
2003-04-24 06:16:04 +00:00
|
|
|
OptionRow( "Dark", "OFF","ON" ),
|
2003-06-15 17:05:51 +00:00
|
|
|
OptionRow( "Step", "" )
|
2002-05-20 08:59:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScreenPlayerOptions::ScreenPlayerOptions() :
|
2003-03-09 00:55:49 +00:00
|
|
|
ScreenOptions("ScreenPlayerOptions",true)
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenPlayerOptions::ScreenPlayerOptions()" );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
Init(
|
2002-08-13 23:26:46 +00:00
|
|
|
INPUTMODE_PLAYERS,
|
2002-05-20 08:59:37 +00:00
|
|
|
g_PlayerOptionsLines,
|
2002-09-03 22:31:06 +00:00
|
|
|
NUM_PLAYER_OPTIONS_LINES,
|
2003-03-15 19:25:37 +00:00
|
|
|
true, false );
|
2002-08-01 05:11:11 +00:00
|
|
|
|
2003-01-02 08:13:34 +00:00
|
|
|
SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("player options intro") );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::ImportOptions()
|
|
|
|
|
{
|
2003-02-17 12:19:42 +00:00
|
|
|
//
|
2003-06-15 17:05:51 +00:00
|
|
|
// fill in difficulty names
|
2003-02-17 12:19:42 +00:00
|
|
|
//
|
2003-06-15 17:05:51 +00:00
|
|
|
m_OptionRow[PO_STEP].choices.clear();
|
|
|
|
|
if( GAMESTATE->m_pCurCourse ) // playing a course
|
2003-02-17 12:19:42 +00:00
|
|
|
{
|
2003-06-15 17:05:51 +00:00
|
|
|
m_OptionRow[PO_STEP].choices.push_back( "REGULAR" );
|
|
|
|
|
if( GAMESTATE->m_pCurCourse->HasDifficult() )
|
|
|
|
|
m_OptionRow[PO_STEP].choices.push_back( "DIFFICULT" );
|
2003-02-17 12:19:42 +00:00
|
|
|
}
|
2003-06-15 17:05:51 +00:00
|
|
|
else
|
2003-04-18 02:13:23 +00:00
|
|
|
{
|
2003-06-15 17:05:51 +00:00
|
|
|
vector<Notes*> vNotes;
|
|
|
|
|
GAMESTATE->m_pCurSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_NotesType );
|
|
|
|
|
SortNotesArrayByDifficulty( vNotes );
|
|
|
|
|
for( unsigned i=0; i<vNotes.size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
CString s = vNotes[i]->GetDescription();
|
|
|
|
|
s.MakeUpper();
|
|
|
|
|
m_OptionRow[PO_STEP].choices.push_back( s );
|
|
|
|
|
}
|
2003-04-18 02:13:23 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-15 17:05:51 +00:00
|
|
|
//
|
|
|
|
|
// highlight currently selected values
|
|
|
|
|
//
|
2002-05-20 08:59:37 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
2003-06-15 17:05:51 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
|
|
|
|
continue; // skip
|
|
|
|
|
|
2002-07-23 01:41:40 +00:00
|
|
|
PlayerOptions &po = GAMESTATE->m_PlayerOptions[p];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-04-24 06:16:04 +00:00
|
|
|
if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 0.25f ) m_iSelectedOption[p][PO_SPEED] = 0;
|
|
|
|
|
else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 0.5f ) m_iSelectedOption[p][PO_SPEED] = 1;
|
|
|
|
|
else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 0.75f ) m_iSelectedOption[p][PO_SPEED] = 2;
|
|
|
|
|
else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 1.0f ) m_iSelectedOption[p][PO_SPEED] = 3;
|
|
|
|
|
else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 1.5f ) m_iSelectedOption[p][PO_SPEED] = 4;
|
|
|
|
|
else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 2.0f ) m_iSelectedOption[p][PO_SPEED] = 5;
|
|
|
|
|
else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 3.0f ) m_iSelectedOption[p][PO_SPEED] = 6;
|
|
|
|
|
else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 5.0f ) m_iSelectedOption[p][PO_SPEED] = 7;
|
2003-05-28 18:42:33 +00:00
|
|
|
else if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 8.0f ) m_iSelectedOption[p][PO_SPEED] = 8;
|
|
|
|
|
else if( po.m_bTimeSpacing && po.m_fScrollBPM == 200 ) m_iSelectedOption[p][PO_SPEED] = 9;
|
2003-04-24 06:16:04 +00:00
|
|
|
else if( po.m_bTimeSpacing && po.m_fScrollBPM == 300 ) m_iSelectedOption[p][PO_SPEED] = 10;
|
2003-02-26 23:26:57 +00:00
|
|
|
else m_iSelectedOption[p][PO_SPEED] = 3;
|
2003-01-25 11:05:12 +00:00
|
|
|
|
2003-02-26 23:26:57 +00:00
|
|
|
m_iSelectedOption[p][PO_ACCEL] = po.GetFirstAccel()+1;
|
|
|
|
|
m_iSelectedOption[p][PO_APPEAR] = po.GetFirstAppearance()+1;
|
|
|
|
|
m_iSelectedOption[p][PO_TURN] = po.m_Turn;
|
|
|
|
|
m_iSelectedOption[p][PO_SCROLL] = po.m_fReverseScroll==1 ? 1 : 0 ;
|
2003-02-17 12:19:42 +00:00
|
|
|
|
|
|
|
|
|
2002-05-27 08:23:27 +00:00
|
|
|
m_iSelectedOption[p][PO_HOLD_NOTES] = po.m_bHoldNotes ? 1 : 0;
|
2003-04-24 06:16:04 +00:00
|
|
|
m_iSelectedOption[p][PO_DARK] = po.m_fDark ? 1 : 0;
|
2003-04-16 22:49:40 +00:00
|
|
|
|
2003-06-15 17:05:51 +00:00
|
|
|
if( GAMESTATE->m_pCurCourse ) // playing a course
|
2003-04-18 02:13:23 +00:00
|
|
|
{
|
2003-06-15 17:05:51 +00:00
|
|
|
if( GAMESTATE->m_bDifficultCourses )
|
|
|
|
|
m_iSelectedOption[p][PO_STEP] = 1;
|
|
|
|
|
else
|
|
|
|
|
m_iSelectedOption[p][PO_STEP] = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
vector<Notes*> vNotes;
|
|
|
|
|
GAMESTATE->m_pCurSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_NotesType );
|
|
|
|
|
SortNotesArrayByDifficulty( vNotes );
|
|
|
|
|
for( unsigned i=0; i<vNotes.size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
if( GAMESTATE->m_pCurNotes[p] == vNotes[i] )
|
|
|
|
|
m_iSelectedOption[p][PO_STEP] = i;
|
|
|
|
|
}
|
2003-04-18 02:13:23 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::ExportOptions()
|
|
|
|
|
{
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
2003-06-15 17:05:51 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
|
|
|
|
continue; // skip
|
|
|
|
|
|
2002-07-23 01:41:40 +00:00
|
|
|
PlayerOptions &po = GAMESTATE->m_PlayerOptions[p];
|
2003-02-26 23:26:57 +00:00
|
|
|
po.Init();
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
switch( m_iSelectedOption[p][PO_SPEED] )
|
|
|
|
|
{
|
2003-04-24 06:16:04 +00:00
|
|
|
case 0: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 0.25f; break;
|
|
|
|
|
case 1: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 0.5f; break;
|
|
|
|
|
case 2: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 0.75f; break;
|
|
|
|
|
case 3: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 1.0f; break;
|
|
|
|
|
case 4: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 1.5f; break;
|
|
|
|
|
case 5: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 2.0f; break;
|
|
|
|
|
case 6: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 3.0f; break;
|
|
|
|
|
case 7: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 5.0f; break;
|
|
|
|
|
case 8: po.m_bTimeSpacing = false; po.m_fScrollSpeed = 8.0f; break;
|
|
|
|
|
case 9: po.m_bTimeSpacing = true; po.m_fScrollBPM = 200; break;
|
|
|
|
|
case 10:po.m_bTimeSpacing = true; po.m_fScrollBPM = 300; break;
|
2003-04-16 22:49:40 +00:00
|
|
|
default: ASSERT(0);
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2003-02-26 23:26:57 +00:00
|
|
|
if( m_iSelectedOption[p][PO_ACCEL] != 0 )
|
|
|
|
|
po.SetOneAccel( (PlayerOptions::Accel)(m_iSelectedOption[p][PO_ACCEL]-1) );
|
|
|
|
|
if( m_iSelectedOption[p][PO_APPEAR] != 0 )
|
|
|
|
|
po.SetOneAppearance( (PlayerOptions::Appearance)(m_iSelectedOption[p][PO_APPEAR]-1) );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-02-26 23:26:57 +00:00
|
|
|
po.m_Turn = (PlayerOptions::Turn)m_iSelectedOption[p][PO_TURN];
|
|
|
|
|
po.m_fReverseScroll = (m_iSelectedOption[p][PO_SCROLL] == 1) ? 1.f : 0.f;
|
2003-02-17 12:19:42 +00:00
|
|
|
|
|
|
|
|
|
2003-04-01 19:31:27 +00:00
|
|
|
po.m_bHoldNotes = (m_iSelectedOption[p][PO_HOLD_NOTES] == 1);
|
2003-04-24 06:16:04 +00:00
|
|
|
po.m_fDark = (m_iSelectedOption[p][PO_DARK] == 1) ? 1.f : 0.f;
|
2003-06-15 17:05:51 +00:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// apply difficulty selection
|
|
|
|
|
//
|
|
|
|
|
if( GAMESTATE->m_pCurCourse ) // playing a course
|
2003-04-18 02:13:23 +00:00
|
|
|
{
|
2003-06-15 17:05:51 +00:00
|
|
|
if( m_iSelectedOption[p][PO_STEP] == 1 )
|
|
|
|
|
GAMESTATE->m_bDifficultCourses = true;
|
|
|
|
|
else
|
|
|
|
|
GAMESTATE->m_bDifficultCourses = false;
|
2003-04-18 02:13:23 +00:00
|
|
|
}
|
2003-06-15 17:05:51 +00:00
|
|
|
else
|
2003-04-18 02:13:23 +00:00
|
|
|
{
|
2003-06-15 17:05:51 +00:00
|
|
|
vector<Notes*> vNotes;
|
|
|
|
|
GAMESTATE->m_pCurSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_NotesType );
|
|
|
|
|
SortNotesArrayByDifficulty( vNotes );
|
|
|
|
|
GAMESTATE->m_pCurNotes[p] = vNotes[ m_iSelectedOption[p][PO_STEP] ];
|
2003-04-18 02:13:23 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::GoToPrevState()
|
|
|
|
|
{
|
2003-02-19 05:46:09 +00:00
|
|
|
if( GAMESTATE->m_bEditing )
|
|
|
|
|
SCREENMAN->PopTopScreen();
|
2002-08-24 02:46:09 +00:00
|
|
|
else
|
2003-04-16 22:49:40 +00:00
|
|
|
SCREENMAN->SetNewScreen( PREV_SCREEN(GAMESTATE->m_PlayMode) );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::GoToNextState()
|
|
|
|
|
{
|
2003-02-19 05:46:09 +00:00
|
|
|
if( GAMESTATE->m_bEditing )
|
|
|
|
|
SCREENMAN->PopTopScreen();
|
2003-04-21 22:36:45 +00:00
|
|
|
else
|
2003-06-15 17:05:51 +00:00
|
|
|
SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-03-11 08:52:45 +00:00
|
|
|
void ScreenPlayerOptions::Update( float fDelta )
|
|
|
|
|
{
|
|
|
|
|
ScreenOptions::Update( fDelta );
|
|
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-03-11 08:52:45 +00:00
|
|
|
void ScreenPlayerOptions::DrawPrimitives()
|
|
|
|
|
{
|
|
|
|
|
ScreenOptions::DrawPrimitives();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
|
|
|
{
|
|
|
|
|
ScreenOptions::Input( DeviceI, type, GameI, MenuI, StyleI );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
ScreenOptions::HandleScreenMessage( SM );
|
|
|
|
|
}
|