New ScreenEditMenu

This commit is contained in:
Chris Danford
2003-01-30 07:18:33 +00:00
parent b75a9716d5
commit 3ddadbe82f
34 changed files with 616 additions and 443 deletions
+2
View File
@@ -7,6 +7,8 @@ NEW FEATURE: New modifier: Acceleration-Boomerang
CHANGE: Tweaked Acceleration-Wave for more of a challenge
CHANGE: Changed format NoteSkin tap graphic format. Existing NoteSkins will
need to update the tap graphic.
NEW FEATURE: New Edit menus with ability to delete Notes patterns and new
options for importing existing patterns into a new Notes pattern.
----------------------- Version 3.01 ---------------------------
CHANGE: Simplified NoteSkin tap graphic format. Old NoteSkins will need to
+34 -1
View File
@@ -455,7 +455,7 @@ TextZoom=0.8
ExplanationX=320
ExplanationY=410
ExplanationText=In this mode, you can edit existing notes patterns,::create note patterns, or synchronize notes with the music.
HelpText=&UP; &DOWN change line &LEFT; &RIGHT; change value START to continue
HelpText=&UP; &DOWN; change line &LEFT; &RIGHT; change value START to continue
[ScreenManager]
StatsX=632
@@ -835,3 +835,36 @@ NumCharsToDrawBehind=2
NumCharsToDrawTotal=10
FakeBeatsPerSec=2.5
TimerSeconds=24
[SongSelector]
Arrows1X=190
Arrows2X=590
SongBannerX=490
SongBannerY=130
SongBannerWidth=130
SongBannerHeight=40
SongTextBannerX=320
SongTextBannerY=130
GroupBannerX=490
GroupBannerY=80
GroupBannerWidth=130
GroupBannerHeight=40
MeterX=490
MeterY=220
SourceMeterX=490
SourceMeterY=300
RowLabelsX=20
RowValue1X=320
RowValue2X=380
RowValue3X=380
RowValue4X=320
RowValue5X=380
RowValue6X=320
RowValue7X=380
Row1Y=80
Row2Y=130
Row3Y=180
Row4Y=220
Row5Y=260
Row6Y=300
Row7Y=340
+1 -1
View File
@@ -45,7 +45,7 @@ enum RadarCategory // starting from 12-o'clock rotating clockwise
RADAR_AIR,
RADAR_FREEZE,
RADAR_CHAOS,
NUM_RADAR_VALUES // leave this at the end
NUM_RADAR_CATEGORIES // leave this at the end
};
enum Difficulty
+1 -1
View File
@@ -34,7 +34,7 @@ MenuInput GameDef::GameInputToMenuInput( GameInput GameI ) const
PlayerNumber pn;
StyleDef::StyleType type = StyleDef::TWO_PLAYERS_TWO_CREDITS;
if( GAMESTATE->m_CurStyle != STYLE_NONE )
if( GAMESTATE->m_CurStyle != STYLE_INVALID )
type = GAMESTATE->GetCurrentStyleDef()->m_StyleType;
switch( type )
{
+12 -2
View File
@@ -1508,11 +1508,11 @@ GameDef* GameManager::GetGameDefForGame( Game g )
const StyleDef* GameManager::GetStyleDefForStyle( Style s )
{
ASSERT( s != STYLE_NONE ); // the style must be set before calling this
ASSERT( s != STYLE_INVALID ); // the style must be set before calling this
return &g_StyleDefs[ s ];
}
void GameManager::GetGameplayStylesForGame( Game game, vector<Style>& aStylesAddTo, bool editor )
void GameManager::GetStylesForGame( Game game, vector<Style>& aStylesAddTo, bool editor )
{
for( int s=0; s<NUM_STYLES; s++ ) {
if( g_StyleDefs[s].m_Game != game)
@@ -1526,6 +1526,16 @@ void GameManager::GetGameplayStylesForGame( Game game, vector<Style>& aStylesAdd
}
}
Style GameManager::GetEditorStyleForNotesType( NotesType nt )
{
for( int s=0; s<NUM_STYLES; s++ )
if( g_StyleDefs[s].m_NotesType == nt && g_StyleDefs[s].m_bUsedForEdit )
return (Style)s;
ASSERT(0); // this style doesn't have a StyleDef that can be used with the editor!
return STYLE_INVALID;
}
void GameManager::GetModesChoicesForGame( Game game, vector<ModeChoice*>& apChoicesAddTo )
{
for( int s=0; s<NUM_MODE_CHOICES; s++ )
+4 -3
View File
@@ -28,9 +28,10 @@ public:
GameDef* GetGameDefForGame( Game g );
const StyleDef* GetStyleDefForStyle( Style s );
void GetGameplayStylesForGame( Game game, vector<Style>& aStylesAddTo, bool editor=false );
void GetModesChoicesForGame( Game game, vector<ModeChoice*>& apChoicesAddTo );
void GetNotesTypesForGame( Game game, vector<NotesType>& aNotesTypeAddTo ); // only look at edit-specific styles
void GetStylesForGame( Game game, vector<Style>& aStylesAddTo, bool editor=false );
void GetModesChoicesForGame( Game game, vector<ModeChoice*>& apChoicesAddTo );
void GetNotesTypesForGame( Game game, vector<NotesType>& aNotesTypeAddTo );
Style GetEditorStyleForNotesType( NotesType nt );
// void GetGameNames( CStringArray &AddTo );
// bool DoesGameExist( CString sGameName );
+3 -3
View File
@@ -52,7 +52,7 @@ void GameState::Reset()
{
int p;
m_CurStyle = STYLE_NONE;
m_CurStyle = STYLE_INVALID;
m_bPlayersCanJoin = false;
for( p=0; p<NUM_PLAYERS; p++ )
m_bSideIsJoined[p] = false;
@@ -172,13 +172,13 @@ GameDef* GameState::GetCurrentGameDef()
const StyleDef* GameState::GetCurrentStyleDef()
{
ASSERT( m_CurStyle != STYLE_NONE ); // the style must be set before calling this
ASSERT( m_CurStyle != STYLE_INVALID ); // the style must be set before calling this
return GAMEMAN->GetStyleDefForStyle( m_CurStyle );
}
bool GameState::IsPlayerEnabled( PlayerNumber pn )
{
if( m_CurStyle == STYLE_NONE ) // if no style set (we're in TitleMenu, ConfigInstruments or something)
if( m_CurStyle == STYLE_INVALID ) // if no style set (we're in TitleMenu, ConfigInstruments or something)
return true; // allow input from both sides
switch( GetCurrentStyleDef()->m_StyleType )
+1 -1
View File
@@ -44,7 +44,7 @@ void GrayArrow::Update( float fDeltaTime )
int OnState = (GetNumStates() == 3)? 1: 0;
int OffState = (GetNumStates() == 3)? 2: 1;
if( !GAMESTATE->m_fSongBeat > 0 )
if( GAMESTATE->m_fSongBeat<0 )
{
SetState( IdleState );
return;
-2
View File
@@ -16,8 +16,6 @@
#include "Song.h"
const int NUM_RADAR_CATEGORIES = 5;
class GrooveRadar : public ActorFrame
{
public:
+1 -1
View File
@@ -232,7 +232,7 @@ bool InputMapper::GameToDevice( GameInput GameI, int iSoltNum, DeviceInput& Devi
void InputMapper::GameToStyle( GameInput GameI, StyleInput &StyleI )
{
if( GAMESTATE->m_CurStyle == STYLE_NONE )
if( GAMESTATE->m_CurStyle == STYLE_INVALID )
{
StyleI.MakeInvalid();
return;
+1 -1
View File
@@ -87,7 +87,7 @@ void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString
m_sprStyleIcon.Load( THEME->GetPathTo("Graphics",ssprintf("menu style icons %s",GAMESTATE->GetCurrentGameDef()->m_szName)) );
m_sprStyleIcon.StopAnimating();
m_sprStyleIcon.SetXY( STYLE_ICON_X, STYLE_ICON_Y );
if( GAMESTATE->m_CurStyle == STYLE_NONE || !bShowStyleIcon )
if( GAMESTATE->m_CurStyle == STYLE_INVALID || !bShowStyleIcon )
m_sprStyleIcon.SetDiffuse( RageColor(1,1,1,0) );
else
{
+1 -1
View File
@@ -306,7 +306,7 @@ MusicWheel::MusicWheel()
g_fItemCurveX = ITEM_CURVE_X;
// for debugging
if( GAMESTATE->m_CurStyle == STYLE_NONE )
if( GAMESTATE->m_CurStyle == STYLE_INVALID )
GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE;
m_sprSelectionOverlay.Load( THEME->GetPathTo("Graphics","select music song highlight") );
+45 -4
View File
@@ -41,7 +41,7 @@ Notes::Notes()
m_NotesType = NOTES_TYPE_DANCE_SINGLE;
m_Difficulty = DIFFICULTY_INVALID;
m_iMeter = 0;
for(int i = 0; i < NUM_RADAR_VALUES; ++i)
for(int i = 0; i < NUM_RADAR_CATEGORIES; ++i)
m_fRadarValues[i] = -1; /* unknown */
m_iNumTimesPlayed = 0;
@@ -176,7 +176,7 @@ bool CompareNotesPointersByRadarValues(const Notes* pNotes1, const Notes* pNotes
float fScore1 = 0;
float fScore2 = 0;
for( int r=0; r<NUM_RADAR_VALUES; r++ )
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
fScore1 += pNotes1->GetRadarValues()[r];
fScore2 += pNotes2->GetRadarValues()[r];
@@ -257,7 +257,7 @@ void Notes::DeAutogen()
m_iMeter = Real()->m_iMeter;
m_sDescription = Real()->m_sDescription;
m_Difficulty = Real()->m_Difficulty;
for(int i = 0; i < NUM_RADAR_VALUES; ++i)
for(int i = 0; i < NUM_RADAR_CATEGORIES; ++i)
m_fRadarValues[i] = Real()->m_fRadarValues[i];
delete notes;
@@ -277,6 +277,47 @@ void Notes::AutogenFrom( Notes *parent_, NotesType ntTo )
m_NotesType = ntTo;
}
void Notes::BakeAutoGen()
{
NoteData noteData;
parent->GetNoteData( &noteData );
this->SetNoteData( &noteData );
this->SetDescription( "AutoGen'd from "+parent->GetDescription() );
this->SetDifficulty( parent->GetDifficulty() );
this->SetMeter( parent->GetMeter() );
const float* radarValues = parent->GetRadarValues();
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
this->SetRadarValue( (RadarCategory)r, radarValues[r] );
parent = NULL;
}
void Notes::CopyFrom( Notes* pSource, NotesType ntTo ) // pSource does not have to be of the same NotesType!
{
m_NotesType = ntTo;
NoteData noteData;
pSource->GetNoteData( &noteData );
noteData.m_iNumTracks = GameManager::NotesTypeToNumTracks(ntTo);
this->SetNoteData( &noteData );
this->SetDescription( "Copied from "+pSource->GetDescription() );
this->SetDifficulty( pSource->GetDifficulty() );
this->SetMeter( pSource->GetMeter() );
const float* radarValues = pSource->GetRadarValues();
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
this->SetRadarValue( (RadarCategory)r, radarValues[r] );
}
void Notes::CreateBlank( NotesType ntTo )
{
m_NotesType = ntTo;
NoteData noteData;
noteData.m_iNumTracks = GameManager::NotesTypeToNumTracks(ntTo);
this->SetNoteData( &noteData );
}
const Notes *Notes::Real() const
{
if(parent) return parent;
@@ -309,7 +350,7 @@ void Notes::SetMeter(int meter)
void Notes::SetRadarValue(int r, float val)
{
DeAutogen();
ASSERT(r < NUM_RADAR_VALUES);
ASSERT(r < NUM_RADAR_CATEGORIES);
m_fRadarValues[r] = val;
}
+8 -3
View File
@@ -45,9 +45,14 @@ public:
void SetNoteData( NoteData* pNewNoteData );
void SetSMNoteData( const CString &out );
CString GetSMNoteData() const;
void AutogenFrom( Notes *parent, NotesType ntTo );
RageColor GetColor() const; // a function of difficulty
// initializers
void AutogenFrom( Notes *parent, NotesType ntTo );
void BakeAutoGen(); // makes into an AutoGen Notes into a regular Notes
void CopyFrom( Notes* pSource, NotesType ntTo );
void CreateBlank( NotesType ntTo );
// High scores;
int m_iNumTimesPlayed;
@@ -80,7 +85,7 @@ protected:
CString m_sDescription; // This text is displayed next to the number of feet when a song is selected
Difficulty m_Difficulty; // difficulty classification
int m_iMeter; // difficulty rating from 1-10
float m_fRadarValues[NUM_RADAR_VALUES]; // between 0.0-1.2 starting from 12-o'clock rotating clockwise
float m_fRadarValues[NUM_RADAR_CATEGORIES]; // between 0.0-1.2 starting from 12-o'clock rotating clockwise
/* If this Notes is autogenerated, make it a real Notes. */
void DeAutogen();
+2 -2
View File
@@ -43,8 +43,8 @@ void SMLoader::LoadFromSMTokens(
out.SetMeter(atoi(sMeter));
CStringArray saValues;
split( sRadarValues, ",", saValues, true );
if( saValues.size() == NUM_RADAR_VALUES )
for( int r=0; r<NUM_RADAR_VALUES; r++ )
if( saValues.size() == NUM_RADAR_CATEGORIES )
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
out.SetRadarValue(r, (float)atof(saValues[r]));
out.SetSMNoteData(sNoteData);
+1 -1
View File
@@ -83,7 +83,7 @@ void NotesWriterSM::WriteSMNotesTag( const Notes &in, FILE* fp )
fprintf( fp, " %d:\n", in.GetMeter() );
CStringArray asRadarValues;
for( int r=0; r < NUM_RADAR_VALUES; r++ )
for( int r=0; r < NUM_RADAR_CATEGORIES; r++ )
asRadarValues.push_back( ssprintf("%.3f", in.GetRadarValues()[r]) );
fprintf( fp, " %s:\n", join(",",asRadarValues).GetString() );
+7 -108
View File
@@ -133,113 +133,6 @@ CString DeviceInput::GetDescription()
case DEVICE_KEYBOARD: // keyboard
sReturn = ssprintf("Key %s", SDL_GetKeyName((SDLKey)button) );
/*
switch( button )
{
case SDLK_ESCAPE: sReturn += "Escape"; break;
case SDLK_1: sReturn += "1"; break;
case SDLK_2: sReturn += "2"; break;
case SDLK_3: sReturn += "3"; break;
case SDLK_4: sReturn += "4"; break;
case SDLK_5: sReturn += "5"; break;
case SDLK_6: sReturn += "6"; break;
case SDLK_7: sReturn += "7"; break;
case SDLK_8: sReturn += "8"; break;
case SDLK_9: sReturn += "9"; break;
case SDLK_0: sReturn += "0"; break;
case SDLK_MINUS: sReturn += "Minus"; break;
case SDLK_EQUALS: sReturn += "Equals"; break;
case SDLK_BACKSPACE: sReturn += "Backsp"; break;
case SDLK_TAB: sReturn += "Tab"; break;
case SDLK_Q: sReturn += "Q"; break;
case SDLK_W: sReturn += "W"; break;
case SDLK_E: sReturn += "E"; break;
case SDLK_R: sReturn += "R"; break;
case SDLK_T: sReturn += "T"; break;
case SDLK_Y: sReturn += "Y"; break;
case SDLK_U: sReturn += "U"; break;
case SDLK_I: sReturn += "I"; break;
case SDLK_O: sReturn += "O"; break;
case SDLK_P: sReturn += "P"; break;
case SDLK_LBRACKET: sReturn += "LBracket"; break;
case SDLK_RBRACKET: sReturn += "RBracket"; break;
case SDLK_RETURN: sReturn += "Return"; break;
case SDLK_LCONTROL: sReturn += "LControl"; break;
case SDLK_A: sReturn += "A"; break;
case SDLK_S: sReturn += "S"; break;
case SDLK_D: sReturn += "D"; break;
case SDLK_F: sReturn += "F"; break;
case SDLK_G: sReturn += "G"; break;
case SDLK_H: sReturn += "H"; break;
case SDLK_J: sReturn += "J"; break;
case SDLK_K: sReturn += "K"; break;
case SDLK_L: sReturn += "L"; break;
case SDLK_SEMICOLON: sReturn += "Semicln"; break;
case SDLK_APOSTROPHE:sReturn += "Apostro"; break;
case SDLK_GRAVE: sReturn += "Grave"; break;
case SDLK_LSHIFT: sReturn += "LShift"; break;
case SDLK_BACKSLASH: sReturn += "Backslsh"; break;
case SDLK_Z: sReturn += "Z"; break;
case SDLK_X: sReturn += "X"; break;
case SDLK_C: sReturn += "C"; break;
case SDLK_V: sReturn += "V"; break;
case SDLK_B: sReturn += "B"; break;
case SDLK_N: sReturn += "N"; break;
case SDLK_M: sReturn += "M"; break;
case SDLK_COMMA: sReturn += "Comma"; break;
case SDLK_PERIOD: sReturn += "Period"; break;
case SDLK_SLASH: sReturn += "Slash"; break;
case SDLK_RSHIFT: sReturn += "RShift"; break;
case SDLK_MULTIPLY: sReturn += "Mult"; break;
case SDLK_LMENU: sReturn += "LMenu"; break;
case SDLK_SPACE: sReturn += "Space"; break;
case SDLK_CAPITAL: sReturn += "CapsLk"; break;
case SDLK_F1: sReturn += "F1"; break;
case SDLK_F2: sReturn += "F2"; break;
case SDLK_F3: sReturn += "F3"; break;
case SDLK_F4: sReturn += "F4"; break;
case SDLK_F5: sReturn += "F5"; break;
case SDLK_F6: sReturn += "F6"; break;
case SDLK_F7: sReturn += "F7"; break;
case SDLK_F8: sReturn += "F8"; break;
case SDLK_F9: sReturn += "F9"; break;
case SDLK_F10: sReturn += "F10"; break;
case SDLK_NUMLOCK: sReturn += "Numlock"; break;
case SDLK_SCROLL: sReturn += "Scroll"; break;
case SDLK_NUMPAD7: sReturn += "NumPad7"; break;
case SDLK_NUMPAD8: sReturn += "NumPad8"; break;
case SDLK_NUMPAD9: sReturn += "NumPad9"; break;
case SDLK_SUBTRACT: sReturn += "Subtract"; break;
case SDLK_NUMPAD4: sReturn += "NumPad4"; break;
case SDLK_NUMPAD5: sReturn += "NumPad5"; break;
case SDLK_NUMPAD6: sReturn += "NumPad6"; break;
case SDLK_ADD: sReturn += "Add"; break;
case SDLK_NUMPAD1: sReturn += "NumPad1"; break;
case SDLK_NUMPAD2: sReturn += "NumPad2"; break;
case SDLK_NUMPAD3: sReturn += "NumPad3"; break;
case SDLK_NUMPAD0: sReturn += "NumPad0"; break;
case SDLK_DECIMAL: sReturn += "Decimal"; break;
case SDLK_RMENU: sReturn += "RightAlt"; break;
case SDLK_PAUSE: sReturn += "Pause"; break;
case SDLK_HOME: sReturn += "Home"; break;
case SDLK_UP: sReturn += "Up"; break;
case SDLK_PRIOR: sReturn += "PageUp"; break;
case SDLK_LEFT: sReturn += "Left"; break;
case SDLK_RIGHT: sReturn += "Right"; break;
case SDLK_END: sReturn += "End"; break;
case SDLK_DOWN: sReturn += "Down"; break;
case SDLK_NEXT: sReturn += "PageDn"; break;
case SDLK_INSERT: sReturn += "Insert"; break;
case SDLK_DELETE: sReturn += "Delete"; break;
case SDLK_LWIN: sReturn += "LeftWin"; break;
case SDLK_RWIN: sReturn += "RightWin"; break;
case SDLK_APPS: sReturn += "AppMenu"; break;
case SDLK_NUMPADENTER: sReturn += "PadEnter"; break;
case SDLK_DIVIDE: sReturn += "PadSlash"; break;
default: sReturn += "Unknown Key"; break;
}
*/
break;
default:
ASSERT(0); // what device is this?
@@ -338,10 +231,16 @@ RageInput::RageInput()
//
memset( m_pJoystick, 0, sizeof(m_pJoystick) );
int iNumJoySticks = min( SDL_NumJoysticks(), NUM_JOYSTICKS );
LOG->Info( "Found %d joysticks", iNumJoySticks );
for( int i=0; i<iNumJoySticks; i++ )
{
m_pJoystick[i] = SDL_JoystickOpen( i );
LOG->Info( "Found joystick %d: %s", i, SDL_JoystickName(i) );
LOG->Info( " %d: '%s' axes: %d, hats: %d, buttons: %d",
i,
SDL_JoystickName(i),
SDL_JoystickNumAxes(m_pJoystick[i]),
SDL_JoystickNumHats(m_pJoystick[i]),
SDL_JoystickNumButtons(m_pJoystick[i]) );
}
SDL_JoystickEventState( SDL_IGNORE );
+1 -1
View File
@@ -1437,7 +1437,7 @@ void ScreenEdit::MenuItemGainFocus( BitmapText* menuitem )
{
menuitem->SetEffectCamelion( 2.5, RageColor(1,1,1,1), RageColor(0,1,0,1) );
menuitem->SetZoom( 0.7f );
SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","edit menu change") );
SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","edit menu row") );
}
void ScreenEdit::MenuItemLoseFocus( BitmapText* menuitem )
+110 -39
View File
@@ -31,17 +31,17 @@
#define EXPLANATION_TEXT THEME->GetMetric("ScreenEditMenu","ExplanationText")
#define HELP_TEXT THEME->GetMetric("ScreenEditMenu","HelpText")
const ScreenMessage SM_RefreshSelector = (ScreenMessage)(SM_User+1);
ScreenEditMenu::ScreenEditMenu()
{
LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" );
GAMESTATE->m_CurStyle = STYLE_NONE;
GAMESTATE->m_CurStyle = STYLE_INVALID;
Selector.SetXY( 0, 0 );
// Selector.AllowNewNotes();
this->AddChild( &Selector );
m_Selector.SetXY( 0, 0 );
// m_Selector.AllowNewNotes();
this->AddChild( &m_Selector );
m_Menu.Load(
THEME->GetPathTo("BGAnimations","edit menu"),
@@ -63,6 +63,7 @@ ScreenEditMenu::ScreenEditMenu()
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","edit menu music") );
m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") );
m_soundCreate.Load( THEME->GetPathTo("Sounds","edit menu create") );
m_Menu.TweenOnScreenFromBlack( SM_None );
}
@@ -91,24 +92,13 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_RefreshSelector:
m_Selector.Refresh();
break;
case SM_GoToPrevScreen:
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
break;
case SM_GoToNextScreen:
// set the current style based on the notes type
// Dro Kulix:
// A centralized solution for this switching mess...
// (See GameConstantsAndTypes.h)
//
// Chris:
// Find the first Style that will play the selected notes type.
// Set the current Style, then let ScreenEdit infer the desired
// NotesType from that Style.
Style style = Selector.GetSelectedStyle();
GAMESTATE->m_CurStyle = style;
GAMESTATE->m_CurGame = GAMEMAN->GetStyleDefForStyle(style)->m_Game;
SCREENMAN->SetNewScreen( "ScreenEdit" );
break;
}
@@ -116,22 +106,32 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
void ScreenEditMenu::MenuUp( PlayerNumber pn )
{
Selector.Up();
m_Selector.Up();
}
void ScreenEditMenu::MenuDown( PlayerNumber pn )
{
Selector.Down();
m_Selector.Down();
}
void ScreenEditMenu::MenuLeft( PlayerNumber pn, const InputEventType type )
{
Selector.Left();
m_Selector.Left();
}
void ScreenEditMenu::MenuRight( PlayerNumber pn, const InputEventType type )
{
Selector.Right();
m_Selector.Right();
}
// helpers for MenuStart() below
void DeleteCurNotes()
{
Song* pSong = GAMESTATE->m_pCurSong;
Notes* pNotesToDelete = GAMESTATE->m_pCurNotes[PLAYER_1];
pSong->RemoveNotes( pNotesToDelete );
pSong->Save();
}
void ScreenEditMenu::MenuStart( PlayerNumber pn )
@@ -139,27 +139,98 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
if( m_Fade.IsClosing() || m_Fade.IsClosed() )
return;
GAMESTATE->m_pCurSong = Selector.GetSelectedSong();
Song* pSong = m_Selector.GetSelectedSong();
NotesType nt = m_Selector.GetSelectedNotesType();
Difficulty dc = m_Selector.GetSelectedDifficulty();
Notes* pNotes = m_Selector.GetSelectedNotes();
// NotesType soureNT = m_Selector.GetSelectedSourceNotesType();
// Difficulty sourceDiff = m_Selector.GetSelectedSourceDifficulty();
Notes* pSourceNotes = m_Selector.GetSelectedSourceNotes();
SongSelector::Action action = m_Selector.GetSelectedAction();
if( !GAMESTATE->m_pCurSong->HasMusic() )
GAMESTATE->m_pCurSong = pSong;
GAMESTATE->m_CurStyle = GAMEMAN->GetEditorStyleForNotesType( nt );
GAMESTATE->m_pCurNotes[PLAYER_1] = pNotes;
//
// handle error cases
//
if( !pSong->HasMusic() )
{
SCREENMAN->SystemMessage( "This song is missing a music file and cannot be edited" );
SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu invalid") );
SCREENMAN->Prompt( SM_None, "This song is missing a music file and cannot be edited" );
return;
}
SOUNDMAN->StopMusic();
// get the style
GAMESTATE->m_CurStyle = Selector.GetSelectedStyle();
GAMESTATE->m_pCurNotes[PLAYER_1] = Selector.GetSelectedNotes();
m_soundSelect.PlayRandom();
m_Menu.TweenOffScreenToBlack( SM_GoToNextScreen, false );
m_Fade.CloseWipingRight( SM_None );
switch( action )
{
case SongSelector::ACTION_EDIT:
// Prepare prepare for ScreenEdit
ASSERT( pNotes );
SOUNDMAN->StopMusic();
m_soundSelect.PlayRandom();
m_Menu.TweenOffScreenToBlack( SM_GoToNextScreen, false );
m_Fade.CloseWipingRight( SM_None );
break;
case SongSelector::ACTION_DELETE:
ASSERT( pNotes );
SCREENMAN->Prompt( SM_RefreshSelector, "These notes will be lost permanently.\nContinue with delete?", true, false, DeleteCurNotes );
m_Selector.Refresh();
return;
case SongSelector::ACTION_COPY:
ASSERT( !pNotes );
ASSERT( pSourceNotes );
{
// Yuck. Doing the memory allocation doesn't seem right since
// Song allocates all of the other Notes.
Notes* pNewNotes = new Notes;
pNewNotes->CopyFrom( pSourceNotes, nt );
pNewNotes->SetDifficulty( dc );
pSong->AddNotes( pNewNotes );
SCREENMAN->SystemMessage( "Notes created from copy." );
m_soundCreate.PlayRandom();
m_Selector.Refresh();
pSong->Save();
}
return;
case SongSelector::ACTION_AUTOGEN:
ASSERT( !pNotes );
ASSERT( pSourceNotes );
{
// Yuck. Doing the memory allocation doesn't seem right since
// Song allocates all of the other Notes.
Notes* pNewNotes = new Notes;
pNewNotes->CopyFrom( pSourceNotes, nt );
pNewNotes->SetDifficulty( dc );
pSong->AddNotes( pNewNotes );
SCREENMAN->SystemMessage( "AutoGen Notes created." );
m_soundCreate.PlayRandom();
m_Selector.Refresh();
pSong->Save();
}
return;
case SongSelector::ACTION_BLANK:
ASSERT( !pNotes );
{
// Yuck. Doing the memory allocation doesn't seem right since
// Song allocates all of the other Notes.
Notes* pNewNotes = new Notes;
pNewNotes->CreateBlank( nt );
pNewNotes->SetDifficulty( dc );
pNewNotes->SetMeter( 1 );
pSong->AddNotes( pNewNotes );
SCREENMAN->SystemMessage( "Blank Notes created." );
m_soundCreate.PlayRandom();
m_Selector.Refresh();
pSong->Save();
}
return;
default:
ASSERT(0);
}
}
void ScreenEditMenu::MenuBack( PlayerNumber pn )
+2 -1
View File
@@ -34,7 +34,7 @@ private:
void MenuBack( PlayerNumber pn );
void MenuStart( PlayerNumber pn );
SongSelector Selector;
SongSelector m_Selector;
BitmapText m_textExplanation;
@@ -43,6 +43,7 @@ private:
TransitionFade m_Fade;
RandomSample m_soundSelect;
RandomSample m_soundCreate;
};
+3 -3
View File
@@ -369,7 +369,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
m_sprBonusFrame[p].SetXY( BONUS_X(p), BONUS_Y );
this->AddChild( &m_sprBonusFrame[p] );
for( int r=0; r<NUM_RADAR_VALUES; r++ ) // foreach line
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ ) // foreach line
{
m_sprPossibleBar[p][r].Load( THEME->GetPathTo("Graphics","evaluation bars possible 1x2") );
m_sprPossibleBar[p][r].SetState( p );
@@ -614,7 +614,7 @@ void ScreenEvaluation::TweenOnScreen()
vector<Actor*> apActorsInBonusOrStageInfo;
apActorsInBonusOrStageInfo.push_back( &m_sprBonusFrame[p] );
for( i=0; i<NUM_RADAR_VALUES; i++ )
for( i=0; i<NUM_RADAR_CATEGORIES; i++ )
{
apActorsInBonusOrStageInfo.push_back( &m_sprPossibleBar[p][i] );
apActorsInBonusOrStageInfo.push_back( &m_sprActualBar[p][i] );
@@ -686,7 +686,7 @@ void ScreenEvaluation::TweenOffScreen()
m_Grades[p].SettleImmediately();
for( i=0; i<NUM_RADAR_VALUES; i++ )
for( i=0; i<NUM_RADAR_CATEGORIES; i++ )
{
m_sprPossibleBar[p][i].FadeOff( 0, "foldy", MENU_ELEMENTS_TWEEN_TIME );
m_sprActualBar[p][i].FadeOff( 0, "foldy", MENU_ELEMENTS_TWEEN_TIME );
+2 -2
View File
@@ -62,8 +62,8 @@ protected:
// used in arcade
Sprite m_sprBonusFrame[NUM_PLAYERS];
Sprite m_sprPossibleBar[NUM_PLAYERS][NUM_RADAR_VALUES];
Sprite m_sprActualBar[NUM_PLAYERS][NUM_RADAR_VALUES];
Sprite m_sprPossibleBar[NUM_PLAYERS][NUM_RADAR_CATEGORIES];
Sprite m_sprActualBar[NUM_PLAYERS][NUM_RADAR_CATEGORIES];
// used in Oni/Endless
Sprite m_sprCourseFrame[NUM_PLAYERS];
+1 -1
View File
@@ -51,7 +51,7 @@ ScreenManager::ScreenManager()
m_textSystemMessage.SetHorizAlign( Actor::align_left );
m_textSystemMessage.SetVertAlign( Actor::align_top );
m_textSystemMessage.SetXY( 4.0f, 4.0f );
m_textSystemMessage.SetZoom( 1.0f );
m_textSystemMessage.SetZoom( 0.7f );
// m_textSystemMessage.SetShadowLength( 2 );
m_textSystemMessage.SetDiffuse( RageColor(1,1,1,0) );
}
+9 -5
View File
@@ -242,13 +242,17 @@ ScreenNameEntry::ScreenNameEntry()
}
bool bAnyStillEntering = false;
for( int p=0; p<NUM_PLAYERS; p++ )
bAnyStillEntering |= m_bStillEnteringName[p];
if( !bAnyStillEntering )
{
this->SendScreenMessage( SM_GoToNextScreen, 0 );
return;
for( int p=0; p<NUM_PLAYERS; p++ )
bAnyStillEntering |= m_bStillEnteringName[p];
if( !bAnyStillEntering )
{
this->SendScreenMessage( SM_GoToNextScreen, 0 );
return;
}
}
+2 -2
View File
@@ -46,10 +46,10 @@ ScreenSelectStyle::ScreenSelectStyle()
LOG->Trace( "ScreenSelectStyle::ScreenSelectStyle()" );
// Reset the current style and game
GAMESTATE->m_CurStyle = STYLE_NONE;
GAMESTATE->m_CurStyle = STYLE_INVALID;
GAMESTATE->m_bPlayersCanJoin = true;
GAMEMAN->GetGameplayStylesForGame( GAMESTATE->m_CurGame, m_aPossibleStyles );
GAMEMAN->GetStylesForGame( GAMESTATE->m_CurGame, m_aPossibleStyles );
ASSERT( !m_aPossibleStyles.empty() ); // every game should have at least one Style, or else why have the Game? :-)
m_iSelection = 0;
+51 -5
View File
@@ -727,7 +727,7 @@ void Song::ReCalculateRadarValuesAndLastBeat()
NoteData tempNoteData;
pNotes->GetNoteData( &tempNoteData );
for( int r=0; r<NUM_RADAR_VALUES; r++ )
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
/* If it's autogen, radar vals come from the parent. */
if(pNotes->IsAutogen())
@@ -749,13 +749,21 @@ void Song::ReCalculateRadarValuesAndLastBeat()
}
}
void Song::GetNotesThatMatch( NotesType nt, vector<Notes*>& arrayAddTo ) const
void Song::GetNotesThatMatch( NotesType nt, vector<Notes*>& arrayAddTo, bool bIncludeAutoGen ) const
{
for( unsigned i=0; i<m_apNotes.size(); i++ ) // for each of the Song's Notes
{
if( m_apNotes[i]->m_NotesType == nt )
arrayAddTo.push_back( m_apNotes[i] );
}
if( bIncludeAutoGen || !m_apNotes[i]->IsAutogen() )
arrayAddTo.push_back( m_apNotes[i] );
}
Notes* Song::GetNotesThatMatch( NotesType nt, Difficulty dc, bool bIncludeAutoGen ) const
{
for( unsigned i=0; i<m_apNotes.size(); i++ ) // for each of the Song's Notes
if( m_apNotes[i]->m_NotesType==nt && m_apNotes[i]->GetDifficulty()==dc )
if( bIncludeAutoGen || !m_apNotes[i]->IsAutogen() )
return m_apNotes[i];
return NULL;
}
/* Return whether the song is playable in the given style. */
@@ -897,6 +905,19 @@ void Song::AutoGen( NotesType ntTo, NotesType ntFrom )
}
}
void Song::RemoveAutoGenNotes()
{
for( int j=m_apNotes.size()-1; j>=0; j-- )
{
if( m_apNotes[j]->IsAutogen() )
{
delete m_apNotes[j];
m_apNotes.erase( m_apNotes.begin()+j );
}
}
}
Grade Song::GetGradeForDifficulty( const StyleDef *st, PlayerNumber pn, Difficulty dc ) const
{
// return max grade of notes in difficulty class
@@ -1204,3 +1225,28 @@ float Song::GetLastBeat() const
return last;
}
#endif
void Song::AddNotes( Notes* pNotes )
{
m_apNotes.push_back( pNotes );
}
void Song::RemoveNotes( Notes* pNotes )
{
// Avoid any stale Note::parent pointers by removing all AutoGen'd Notes,
// then adding them again.
RemoveAutoGenNotes();
for( unsigned j=m_apNotes.size()-1; j>=0; j-- )
{
if( m_apNotes[j] == pNotes )
{
delete m_apNotes[j];
m_apNotes.erase( m_apNotes.begin()+j );
break;
}
}
AddAutoGenNotes();
}
+210 -206
View File
@@ -20,106 +20,105 @@
//
// Defines specific to SongSelector
//
const float GROUP_X = CENTER_X;
const float GROUP_Y = CENTER_Y - 160;
#define ARROWS_X( i ) THEME->GetMetricF("SongSelector",ssprintf("Arrows%dX",i+1))
#define SONG_BANNER_X THEME->GetMetricF("SongSelector","SongBannerX")
#define SONG_BANNER_Y THEME->GetMetricF("SongSelector","SongBannerY")
#define SONG_BANNER_WIDTH THEME->GetMetricF("SongSelector","SongBannerWidth")
#define SONG_BANNER_HEIGHT THEME->GetMetricF("SongSelector","SongBannerHeight")
#define SONG_TEXT_BANNER_X THEME->GetMetricF("SongSelector","SongTextBannerX")
#define SONG_TEXT_BANNER_Y THEME->GetMetricF("SongSelector","SongTextBannerY")
#define GROUP_BANNER_X THEME->GetMetricF("SongSelector","GroupBannerX")
#define GROUP_BANNER_Y THEME->GetMetricF("SongSelector","GroupBannerY")
#define GROUP_BANNER_WIDTH THEME->GetMetricF("SongSelector","GroupBannerWidth")
#define GROUP_BANNER_HEIGHT THEME->GetMetricF("SongSelector","GroupBannerHeight")
#define METER_X THEME->GetMetricF("SongSelector","MeterX")
#define METER_Y THEME->GetMetricF("SongSelector","MeterY")
#define SOURCE_METER_X THEME->GetMetricF("SongSelector","SourceMeterX")
#define SOURCE_METER_Y THEME->GetMetricF("SongSelector","SourceMeterY")
#define ROW_LABELS_X THEME->GetMetricF("SongSelector","RowLabelsX")
#define ROW_VALUE_X( i ) THEME->GetMetricF("SongSelector",ssprintf("RowValue%dX",i+1))
#define ROW_Y( i ) THEME->GetMetricF("SongSelector",ssprintf("Row%dY",i+1))
const float SONG_BANNER_X = CENTER_X;
const float SONG_BANNER_Y = CENTER_Y - 80;
const float SONG_BANNER_WIDTH = 286;
const float SONG_BANNER_HEIGHT = 92;
const float ARROWS_X[2] = { SONG_BANNER_X - 200, SONG_BANNER_X + 200 };
const float ARROWS_Y[2] = { SONG_BANNER_Y, SONG_BANNER_Y };
const float SONG_TEXT_BANNER_X = CENTER_X;
const float SONG_TEXT_BANNER_Y = CENTER_Y - 10;
const float GAME_STYLE_X = CENTER_X;
const float GAME_STYLE_Y = CENTER_Y + 40;
const float STEPS_X = CENTER_X;
const float STEPS_Y = CENTER_Y + 90;
SongSelector::SongSelector()
{
LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" );
NewNotes = false;
m_bAllowNewNotes = true;
m_textGroup.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
m_textGroup.SetXY( GROUP_X, GROUP_Y );
m_textGroup.SetDiffuse( RageColor(0.7f,0.7f,0.7f,1) );
m_textGroup.SetText( "blah" );
this->AddChild( &m_textGroup );
int i;
m_Banner.SetXY( SONG_BANNER_X, SONG_BANNER_Y );
m_Banner.SetCroppedSize( SONG_BANNER_WIDTH, SONG_BANNER_HEIGHT );
this->AddChild( &m_Banner );
for( i=0; i<2; i++ )
{
m_sprArrows[i].Load( THEME->GetPathTo("Graphics",ssprintf("edit menu %s",(i==0?"left":"right"))) );
m_sprArrows[i].SetX( ARROWS_X(i) );
this->AddChild( &m_sprArrows[i] );
}
m_TextBanner.SetXY( SONG_TEXT_BANNER_X, SONG_TEXT_BANNER_Y );
this->AddChild( &m_TextBanner );
m_SelectedRow = (Row)0;
ZERO( m_iSelection );
for( i=0; i<NUM_ROWS; i++ )
{
m_textLabel[i].LoadFromFont( THEME->GetPathTo("Fonts","header2") );
m_textLabel[i].SetXY( ROW_LABELS_X, ROW_Y(i) );
m_textLabel[i].SetText( RowToString((Row)i) );
m_textLabel[i].SetZoom( 0.8f );
m_textLabel[i].SetHorizAlign( Actor::align_left );
this->AddChild( &m_textLabel[i] );
m_textValue[i].LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_textValue[i].SetXY( ROW_VALUE_X(i), ROW_Y(i) );
m_textValue[i].SetText( "blah" );
m_textValue[i].SetZoom( 0.8f );
this->AddChild( &m_textValue[i] );
}
m_GroupBanner.SetXY( GROUP_BANNER_X, GROUP_BANNER_Y );
m_GroupBanner.SetCroppedSize( GROUP_BANNER_WIDTH, GROUP_BANNER_HEIGHT );
this->AddChild( &m_GroupBanner );
m_SongBanner.SetXY( SONG_BANNER_X, SONG_BANNER_Y );
m_SongBanner.SetCroppedSize( SONG_BANNER_WIDTH, SONG_BANNER_HEIGHT );
this->AddChild( &m_SongBanner );
m_SongTextBanner.SetXY( SONG_TEXT_BANNER_X, SONG_TEXT_BANNER_Y );
this->AddChild( &m_SongTextBanner );
m_Meter.SetXY( METER_X, METER_Y );
this->AddChild( &m_Meter );
m_SourceMeter.SetXY( SOURCE_METER_X, SOURCE_METER_Y );
this->AddChild( &m_SourceMeter );
m_sprArrowLeft.Load( THEME->GetPathTo("Graphics","edit menu left") );
m_sprArrowLeft.SetXY( ARROWS_X[0], ARROWS_Y[0] );
m_sprArrowLeft.SetDiffuse( RageColor(1,1,1,0) );
this->AddChild( &m_sprArrowLeft );
m_sprArrowRight.Load( THEME->GetPathTo("Graphics","edit menu right") );
m_sprArrowRight.SetXY( ARROWS_X[1], ARROWS_Y[1] );
m_sprArrowRight.SetDiffuse( RageColor(1,1,1,0) );
this->AddChild( &m_sprArrowRight );
m_soundChangeRow.Load( THEME->GetPathTo("sounds","edit menu row") );
m_soundChangeValue.Load( THEME->GetPathTo("sounds","edit menu value") );
m_textStyle.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
m_textStyle.SetXY( GAME_STYLE_X, GAME_STYLE_Y );
m_textStyle.SetDiffuse( RageColor(0.7f,0.7f,0.7f,1) );
m_textStyle.SetText( "blah" );
this->AddChild( &m_textStyle );
m_textNotes.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
m_textNotes.SetXY( STEPS_X, STEPS_Y );
m_textNotes.SetDiffuse( RageColor(0.7f,0.7f,0.7f,1) );
m_textNotes.SetText( "blah" );
this->AddChild( &m_textNotes );
// data structures
ChangeSelectedRow(ROW_GROUP);
// fill in data structures
SONGMAN->GetGroupNames( m_sGroups );
GAMEMAN->GetGameplayStylesForGame( GAMESTATE->m_CurGame, m_Styles, true );
m_iSelectedGroup = m_iSelectedSong = m_iSelectedStyle = m_iSelectedNotes = 0;
GAMEMAN->GetNotesTypesForGame( GAMESTATE->m_CurGame, m_NotesTypes );
// Select the current song if any
if( GAMESTATE->m_pCurSong )
{
unsigned i;
for( i=0; i<m_sGroups.size(); i++ )
if( GAMESTATE->m_pCurSong->m_sGroupName == m_sGroups[i] )
m_iSelectedGroup = i;
OnGroupChange();
m_iSelection[ROW_GROUP] = i;
OnRowValueChanged( ROW_GROUP );
for( i=0; i<m_pSongs.size(); i++ )
if( GAMESTATE->m_pCurSong == m_pSongs[i] )
m_iSelectedSong = i;
OnSongChange();
for( i=0; i<m_Styles.size(); i++ )
{
if( GAMESTATE->GetCurrentStyleDef() == GAMEMAN->GetStyleDefForStyle(m_Styles[i]) )
m_iSelectedStyle = i;
}
OnNotesTypeChange();
for( i=0; i<m_pNotess.size(); i++ )
if( GAMESTATE->m_pCurNotes[PLAYER_1] == m_pNotess[i] )
m_iSelectedNotes = i;
OnNotesChange();
m_iSelection[ROW_SONG] = i;
OnRowValueChanged( ROW_SONG );
}
else
OnGroupChange();
m_soundChangeMusic.Load( THEME->GetPathTo("Sounds","select music change") );
ChangeToRow( (Row)0 );
OnRowValueChanged( (Row)0 );
}
SongSelector::~SongSelector()
@@ -127,168 +126,173 @@ SongSelector::~SongSelector()
}
void SongSelector::Refresh()
{
ChangeToRow( (Row)0 );
OnRowValueChanged( (Row)0 );
}
void SongSelector::DrawPrimitives()
{
ActorFrame::DrawPrimitives();
}
bool SongSelector::CanGoUp()
{
return m_SelectedRow != 0;
}
bool SongSelector::CanGoDown()
{
return m_SelectedRow != NUM_ROWS-1;
}
bool SongSelector::CanGoLeft()
{
return m_iSelection[m_SelectedRow] != 0;
}
bool SongSelector::CanGoRight()
{
int num_values[NUM_ROWS] =
{
m_sGroups.size(),
m_pSongs.size(),
m_NotesTypes.size(),
NUM_DIFFICULTIES,
m_NotesTypes.size(),
NUM_DIFFICULTIES,
m_Actions.size()
};
return m_iSelection[m_SelectedRow] != (num_values[m_SelectedRow]-1);
}
void SongSelector::Up()
{
if( m_SelectedRow == 0 ) // can't go up any further
return;
ChangeSelectedRow(SelectedRow(m_SelectedRow-1));
if( CanGoUp() )
{
if( GetSelectedNotes() && m_SelectedRow==ROW_ACTION )
ChangeToRow( ROW_DIFFICULTY );
else
ChangeToRow( Row(m_SelectedRow-1) );
m_soundChangeRow.PlayRandom();
}
}
void SongSelector::Down()
{
if( m_SelectedRow == NUM_ROWS-1 ) // can't go down any further
return;
ChangeSelectedRow(SelectedRow(m_SelectedRow+1));
if( CanGoDown() )
{
if( GetSelectedNotes() && m_SelectedRow==ROW_DIFFICULTY )
ChangeToRow( ROW_ACTION );
else
ChangeToRow( Row(m_SelectedRow+1) );
m_soundChangeRow.PlayRandom();
}
}
void SongSelector::Left()
{
switch( m_SelectedRow )
if( CanGoLeft() )
{
case ROW_GROUP:
if( m_iSelectedGroup == 0 ) // can't go left any further
return;
m_iSelectedGroup--;
OnGroupChange();
break;
case ROW_SONG:
if( m_iSelectedSong == 0 ) // can't go left any further
return;
m_iSelectedSong--;
OnSongChange();
break;
case ROW_STYLE:
if( m_iSelectedStyle == 0 ) // can't go left any further
return;
m_iSelectedStyle--;
OnNotesTypeChange();
break;
case ROW_STEPS:
if( m_iSelectedNotes == 0 ) // can't go left any further
return;
m_iSelectedNotes--;
OnNotesChange();
break;
default:
ASSERT(false);
m_iSelection[m_SelectedRow]--;
OnRowValueChanged( m_SelectedRow );
m_soundChangeValue.PlayRandom();
}
}
void SongSelector::Right()
{
switch( m_SelectedRow )
if( CanGoRight() )
{
m_iSelection[m_SelectedRow]++;
OnRowValueChanged( m_SelectedRow );
m_soundChangeValue.PlayRandom();
}
}
void SongSelector::ChangeToRow( Row newRow )
{
m_SelectedRow = newRow;
for( int i=0; i<2; i++ )
m_sprArrows[i].SetY( ROW_Y(newRow) );
m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) );
m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) );
}
void SongSelector::OnRowValueChanged( Row row )
{
m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) );
m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) );
switch( row )
{
case ROW_GROUP:
if( m_iSelectedGroup == m_sGroups.size()-1 ) // can't go right any further
return;
m_iSelectedGroup++;
OnGroupChange();
break;
m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
m_GroupBanner.LoadFromGroup( GetSelectedGroup() );
m_pSongs.clear();
SONGMAN->GetSongsInGroup( GetSelectedGroup(), m_pSongs );
m_iSelection[ROW_SONG] = 0;
// fall through
case ROW_SONG:
if( m_iSelectedSong == m_pSongs.size()-1 ) // can't go right any further
return;
m_iSelectedSong++;
OnSongChange();
break;
case ROW_STYLE:
if( m_iSelectedStyle == m_Styles.size()-1 ) // can't go right any further
return;
m_iSelectedStyle++;
OnNotesTypeChange();
break;
case ROW_STEPS:
if( m_iSelectedNotes == m_pNotess.size()-1 ) // can't go right any further
return;
m_iSelectedNotes++;
OnNotesChange();
m_textValue[ROW_SONG].SetText( "" );
m_SongBanner.LoadFromSong( GetSelectedSong() );
m_SongTextBanner.LoadFromSong( GetSelectedSong() );
// fall through
case ROW_NOTES_TYPE:
m_textValue[ROW_NOTES_TYPE].SetText( GAMEMAN->NotesTypeToString(GetSelectedNotesType()) );
// fall through
case ROW_DIFFICULTY:
m_textValue[ROW_DIFFICULTY].SetText( DifficultyToString(GetSelectedDifficulty()) );
m_Meter.SetFromNotes( GetSelectedNotes() );
// fall through
case ROW_SOURCE_NOTES_TYPE:
m_textLabel[ROW_SOURCE_NOTES_TYPE].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) );
m_textValue[ROW_SOURCE_NOTES_TYPE].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) );
m_textValue[ROW_SOURCE_NOTES_TYPE].SetText( GAMEMAN->NotesTypeToString(GetSelectedSourceNotesType()) );
// fall through
case ROW_SOURCE_DIFFICULTY:
m_textLabel[ROW_SOURCE_DIFFICULTY].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) );
m_textValue[ROW_SOURCE_DIFFICULTY].SetDiffuse( GetSelectedNotes()?RageColor(1,1,1,0):RageColor(1,1,1,1) );
m_textValue[ROW_SOURCE_DIFFICULTY].SetText( DifficultyToString(GetSelectedSourceDifficulty()) );
m_SourceMeter.SetFromNotes( GetSelectedSourceNotes() );
m_SourceMeter.SetZoomY( GetSelectedNotes()?0.f:1.f );
m_Actions.clear();
if( GetSelectedNotes() )
{
m_Actions.push_back( ACTION_EDIT );
m_Actions.push_back( ACTION_DELETE );
}
else if( GetSelectedSourceNotes() )
{
m_Actions.push_back( ACTION_COPY );
m_Actions.push_back( ACTION_AUTOGEN );
m_Actions.push_back( ACTION_BLANK );
}
else
{
m_Actions.push_back( ACTION_BLANK );
}
m_iSelection[ROW_ACTION] = 0;
// fall through
case ROW_ACTION:
m_textValue[ROW_ACTION].SetText( ActionToString(GetSelectedAction()) );
break;
default:
ASSERT(false);
ASSERT(0); // invalid row
}
}
void SongSelector::ChangeSelectedRow( SelectedRow row )
Notes* SongSelector::GetSelectedNotes()
{
m_textGroup.SetEffectNone();
m_sprArrowLeft.SetDiffuse( RageColor(1,1,1,0) );
m_sprArrowRight.SetDiffuse( RageColor(1,1,1,0) );
m_textStyle.SetEffectNone();
m_textNotes.SetEffectNone();
m_SelectedRow = row;
switch( m_SelectedRow )
{
case ROW_GROUP: m_textGroup.SetEffectGlowing(); break;
case ROW_SONG:
m_sprArrowLeft.SetDiffuse( RageColor(1,1,1,1) );
m_sprArrowRight.SetDiffuse( RageColor(1,1,1,1) );
break;
case ROW_STYLE: m_textStyle.SetEffectGlowing(); break;
case ROW_STEPS: m_textNotes.SetEffectGlowing(); break;
default: ASSERT(false);
}
return GetSelectedSong()->GetNotesThatMatch(GetSelectedNotesType(),GetSelectedDifficulty(), false);
}
void SongSelector::OnGroupChange()
Notes* SongSelector::GetSelectedSourceNotes()
{
m_iSelectedGroup = clamp( m_iSelectedGroup, 0u, m_sGroups.size()-1 );
m_textGroup.SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
// reload songs
m_pSongs.clear();
SONGMAN->GetSongsInGroup( GetSelectedGroup(), m_pSongs );
OnSongChange();
return GetSelectedSong()->GetNotesThatMatch(GetSelectedSourceNotesType(),GetSelectedSourceDifficulty(), false);
}
void SongSelector::OnSongChange()
{
m_iSelectedSong = clamp( m_iSelectedSong, 0u, m_pSongs.size()-1 );
m_Banner.LoadFromSong( GetSelectedSong() );
m_TextBanner.LoadFromSong( GetSelectedSong() );
OnNotesTypeChange();
}
void SongSelector::OnNotesTypeChange()
{
m_iSelectedStyle = clamp( m_iSelectedStyle, 0u, m_Styles.size()-1 );
m_textStyle.SetText( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle())->m_szName );
m_pNotess.clear();
GetSelectedSong()->GetNotesThatMatch( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle())->m_NotesType, m_pNotess );
SortNotesArrayByDifficulty( m_pNotess );
m_pNotess.push_back( NULL ); // marker for "(NEW)"
m_iSelectedNotes = 0;
OnNotesChange();
}
void SongSelector::OnNotesChange()
{
m_iSelectedNotes = clamp( m_iSelectedNotes, 0u, m_pNotess.size()-1 );
if( GetSelectedNotes() == NULL )
m_textNotes.SetText( "(NEW)" );
else
{
CString sDescription = GetSelectedNotes()->GetDescription();
if( sDescription == "" )
sDescription = "[no name]";
if( GetSelectedNotes()->IsAutogen() )
sDescription += " (autogen)";
m_textNotes.SetText( sDescription );
}
}
+89 -36
View File
@@ -11,67 +11,120 @@
-----------------------------------------------------------------------------
*/
#include "stdafx.h"
#include "ActorFrame.h"
#include "MenuElements.h"
#include "Banner.h"
#include "TextBanner.h"
#include "GameConstantsAndTypes.h"
#include "Style.h"
#include "FootMeter.h"
class SongSelector: public ActorFrame {
class SongSelector: public ActorFrame
{
public:
SongSelector();
~SongSelector();
virtual void DrawPrimitives();
bool CanGoUp();
bool CanGoDown();
bool CanGoLeft();
bool CanGoRight();
void Up();
void Down();
void Left();
void Right();
CString GetSelectedGroup() { return m_sGroups[m_iSelectedGroup]; };
Song* GetSelectedSong() { return m_pSongs[m_iSelectedSong]; };
Style GetSelectedStyle() { return m_Styles[m_iSelectedStyle]; };
Notes* GetSelectedNotes() { return m_pNotess[m_iSelectedNotes]; };
enum Row
{
ROW_GROUP,
ROW_SONG,
ROW_NOTES_TYPE,
ROW_DIFFICULTY,
ROW_SOURCE_NOTES_TYPE,
ROW_SOURCE_DIFFICULTY,
ROW_ACTION,
NUM_ROWS
} m_SelectedRow;
CString RowToString( Row r )
{
const CString s[NUM_ROWS] =
{
"Group",
"Song",
"NotesType",
"Difficulty",
"Source NotesType",
"Source Difficulty",
"Action"
};
return s[r];
}
enum Action
{
ACTION_EDIT,
ACTION_DELETE,
ACTION_COPY,
ACTION_AUTOGEN,
ACTION_BLANK,
NUM_ACTIONS
};
CString ActionToString( Action a )
{
const CString s[NUM_ACTIONS] =
{
"Edit Existing",
"Delete Existing",
"Create from Source by Copy",
"Create from Souce by AutoGen",
"Create with Blank"
};
return s[a];
}
void Refresh();
CString GetSelectedGroup() { return m_sGroups[m_iSelection[ROW_GROUP]]; }
Song* GetSelectedSong() { return m_pSongs[m_iSelection[ROW_SONG]]; }
NotesType GetSelectedNotesType() { return m_NotesTypes[m_iSelection[ROW_NOTES_TYPE]]; }
Difficulty GetSelectedDifficulty() { return (Difficulty)m_iSelection[ROW_DIFFICULTY]; }
NotesType GetSelectedSourceNotesType() { return m_NotesTypes[m_iSelection[ROW_SOURCE_NOTES_TYPE]]; }
Difficulty GetSelectedSourceDifficulty() { return (Difficulty)m_iSelection[ROW_SOURCE_DIFFICULTY]; }
Action GetSelectedAction() { return m_Actions[m_iSelection[ROW_ACTION]]; }
Notes* GetSelectedNotes();
Notes* GetSelectedSourceNotes();
/* not used yet */
bool NewNotes;
void AllowNewNotes(bool NewNotes_=true) { NewNotes = NewNotes; }
bool m_bAllowNewNotes;
void AllowNewNotes(bool b) { m_bAllowNewNotes = b; }
private:
enum SelectedRow { ROW_GROUP, ROW_SONG, ROW_STYLE, ROW_STEPS, NUM_ROWS };
SelectedRow m_SelectedRow;
Sprite m_sprArrows[2];
CStringArray m_sGroups;
unsigned m_iSelectedGroup; // index into m_sGroups
BitmapText m_textGroup;
int m_iSelection[NUM_ROWS];
BitmapText m_textLabel[NUM_ROWS];
BitmapText m_textValue[NUM_ROWS];
vector<Song*> m_pSongs;
unsigned m_iSelectedSong; // index into m_pSongs
Banner m_Banner;
TextBanner m_TextBanner;
Banner m_GroupBanner;
Banner m_SongBanner;
TextBanner m_SongTextBanner;
FootMeter m_Meter;
FootMeter m_SourceMeter;
Sprite m_sprArrowLeft;
Sprite m_sprArrowRight;
CStringArray m_sGroups;
vector<NotesType> m_NotesTypes;
vector<Song*> m_pSongs;
vector<Action> m_Actions;
vector<Style> m_Styles;
unsigned m_iSelectedStyle; // index into m_Styles
BitmapText m_textStyle;
void OnRowValueChanged( Row row );
void ChangeToRow( Row newRow );
vector<Notes*> m_pNotess;
unsigned m_iSelectedNotes; // index into m_pNotess
BitmapText m_textNotes;
RandomSample m_soundChangeMusic;
void OnGroupChange();
void OnSongChange();
void OnNotesTypeChange();
void OnNotesChange();
void ChangeSelectedRow( SelectedRow row );
RandomSample m_soundChangeRow;
RandomSample m_soundChangeValue;
};
#endif
+1 -1
View File
@@ -36,7 +36,7 @@ void StageStats::operator+=( const StageStats& other )
iHoldNoteScores[p][h] += iHoldNoteScores[p][h];
iMaxCombo[p] += other.iMaxCombo[p];
fScore[p] += other.fScore[p];
for( int r=0; r<NUM_RADAR_VALUES; r++ )
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
fRadarPossible[p][r] += other.fRadarPossible[p][r];
fRadarActual[p][r] += other.fRadarActual[p][r];
+2 -2
View File
@@ -30,8 +30,8 @@ struct StageStats
int iHoldNoteScores[NUM_PLAYERS][NUM_HOLD_NOTE_SCORES];
int iMaxCombo[NUM_PLAYERS];
float fScore[NUM_PLAYERS];
float fRadarPossible[NUM_PLAYERS][NUM_RADAR_VALUES]; // filled in by ScreenGameplay on start of notes
float fRadarActual[NUM_PLAYERS][NUM_RADAR_VALUES]; // filled in by ScreenGameplay on start of notes
float fRadarPossible[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; // filled in by ScreenGameplay on start of notes
float fRadarActual[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; // filled in by ScreenGameplay on start of notes
float fSecondsBeforeFail[NUM_PLAYERS]; // -1 means didn't/hasn't failed
int iSongsPassed[NUM_PLAYERS]; // For course, this is the number of songs that the player has passed
};
+1 -1
View File
@@ -33,7 +33,7 @@ enum Style
STYLE_DS3DDX_SINGLE,
STYLE_BM_SINGLE,
NUM_STYLES, // leave this at the end
STYLE_NONE,
STYLE_INVALID,
};
const int NUM_DANCE_STYLES = 6;
+1 -1
View File
@@ -38,7 +38,7 @@ void TransitionFade::DrawPrimitives()
CLAMP( fPercentageOpaque, 0, 1 );
RageColor colorTemp = GetDiffuse();
colorTemp.a = fPercentageOpaque;
colorTemp.a *= fPercentageOpaque;
m_rect.SetDiffuse( colorTemp );
m_rect.Draw();
}
+6 -1
View File
@@ -78,6 +78,7 @@ public:
void AddAutoGenNotes();
void AutoGen( NotesType ntTo, NotesType ntFrom ); // create Notes of type ntTo from Notes of type ntFrom
void RemoveAutoGenNotes();
/* Directory this song data came from: */
const CString &GetSongDir() const { return m_sSongDir; }
@@ -194,13 +195,17 @@ public:
bool SongCompleteForStyle( const StyleDef *st ) const;
bool SongHasNotesType( NotesType nt ) const;
bool SongHasNotesTypeAndDifficulty( NotesType nt, Difficulty dc ) const;
void GetNotesThatMatch( NotesType nt, vector<Notes*>& arrayAddTo ) const;
void GetNotesThatMatch( NotesType nt, vector<Notes*>& arrayAddTo, bool bIncludeAutoGen = true ) const;
Notes* GetNotesThatMatch( NotesType nt, Difficulty dc, bool bIncludeAutoGen = true ) const;
int GetNumTimesPlayed() const;
bool IsNew() const;
bool IsEasy( NotesType nt ) const;
Grade GetGradeForDifficulty( const StyleDef *s, PlayerNumber pn, Difficulty dc ) const;
bool NormallyDisplayed() const;
bool RouletteDisplayed() const;
void AddNotes( Notes* pNotes ); // we are responsible for deleting the memory pointed to by pNotes!
void RemoveNotes( Notes* pNotes );
};
+1 -1
View File
@@ -19,7 +19,7 @@
!define PRODUCT_NAME_VER "${PRODUCT_NAME} ${VERSION}"
Name "${PRODUCT_NAME}"
OutFile "stepmania-CVS-20030119.exe"
OutFile "stepmania-CVS-20030128.exe"
;OutFile "stepmania301.exe"
; Some default compiler settings (uncomment and change at will):