fixed EditMenu "Create from Autogen" weirdness

cleaned up some unnecessary header dependencies
This commit is contained in:
Chris Danford
2003-02-22 01:58:56 +00:00
parent 87c9516cc0
commit fc2108e85d
17 changed files with 83 additions and 84 deletions
+2 -3
View File
@@ -131,10 +131,9 @@ EditMenu::~EditMenu()
}
void EditMenu::Refresh()
void EditMenu::RefreshNotes()
{
ChangeToRow( (Row)0 );
OnRowValueChanged( (Row)0 );
OnRowValueChanged( ROW_SONG );
}
void EditMenu::DrawPrimitives()
+1 -1
View File
@@ -85,7 +85,7 @@ public:
return s[a];
}
void Refresh();
void RefreshNotes();
CString GetSelectedGroup() { return m_sGroups[m_iSelection[ROW_GROUP]]; }
-1
View File
@@ -11,7 +11,6 @@
-----------------------------------------------------------------------------
*/
#include "Notes.h"
#include "GameInput.h"
#include "MenuInput.h"
#include "GameConstantsAndTypes.h"
+1
View File
@@ -21,6 +21,7 @@
#include "ThemeManager.h"
#include "RageUtil.h"
#include "SongManager.h"
#include "Notes.h"
#include "NoteSkinManager.h"
+2 -5
View File
@@ -1,3 +1,5 @@
#ifndef _GrayArrow_H_
#define _GrayArrow_H_
/*
-----------------------------------------------------------------------------
Class: GrayArrow
@@ -11,12 +13,7 @@
*/
#ifndef _GrayArrow_H_
#define _GrayArrow_H_
#include "Sprite.h"
#include "Notes.h"
class GrayArrow : public Sprite
{
+1
View File
@@ -24,6 +24,7 @@
#include "GameState.h"
#include <math.h>
#include "ThemeManager.h"
#include "Notes.h"
// WheelItem stuff
+37 -43
View File
@@ -140,43 +140,6 @@ void Notes::TidyUpData()
}
}
//////////////////////////////////////////////
//
//////////////////////////////////////////////
bool CompareNotesPointersByRadarValues(const Notes* pNotes1, const Notes* pNotes2)
{
float fScore1 = 0;
float fScore2 = 0;
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
fScore1 += pNotes1->GetRadarValues()[r];
fScore2 += pNotes2->GetRadarValues()[r];
}
return fScore1 < fScore2;
}
bool CompareNotesPointersByMeter(const Notes *pNotes1, const Notes* pNotes2)
{
return pNotes1->GetMeter() < pNotes2->GetMeter();
}
bool CompareNotesPointersByDifficulty(const Notes *pNotes1, const Notes *pNotes2)
{
return pNotes1->GetDifficulty() < pNotes2->GetDifficulty();
}
void SortNotesArrayByDifficulty( vector<Notes*> &arraySteps )
{
/* Sort in reverse order of priority. */
stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByRadarValues );
stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByMeter );
stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByDifficulty );
}
void Notes::Decompress() const
{
if(notes) return;
@@ -246,12 +209,6 @@ void Notes::AutogenFrom( Notes *parent_, NotesType ntTo )
m_NotesType = ntTo;
}
void Notes::BakeAutoGen()
{
Decompress();
parent = NULL;
}
void Notes::CopyFrom( Notes* pSource, NotesType ntTo ) // pSource does not have to be of the same NotesType!
{
m_NotesType = ntTo;
@@ -333,3 +290,40 @@ void Notes::AddScore( PlayerNumber pn, Grade grade, float fScore, bool& bNewReco
m_MemCardScores[MEMORY_CARD_MACHINE].grade = grade;
}
}
//
// Sorting stuff
//
bool CompareNotesPointersByRadarValues(const Notes* pNotes1, const Notes* pNotes2)
{
float fScore1 = 0;
float fScore2 = 0;
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
fScore1 += pNotes1->GetRadarValues()[r];
fScore2 += pNotes2->GetRadarValues()[r];
}
return fScore1 < fScore2;
}
bool CompareNotesPointersByMeter(const Notes *pNotes1, const Notes* pNotes2)
{
return pNotes1->GetMeter() < pNotes2->GetMeter();
}
bool CompareNotesPointersByDifficulty(const Notes *pNotes1, const Notes *pNotes2)
{
return pNotes1->GetDifficulty() < pNotes2->GetDifficulty();
}
void SortNotesArrayByDifficulty( vector<Notes*> &arraySteps )
{
/* Sort in reverse order of priority. */
stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByRadarValues );
stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByMeter );
stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByDifficulty );
}
+6 -10
View File
@@ -23,10 +23,14 @@ public:
Notes();
~Notes();
void Decompress() const;
// initializers
void AutogenFrom( Notes *parent, NotesType ntTo );
void CopyFrom( Notes* pSource, NotesType ntTo );
void CreateBlank( NotesType ntTo );
public:
void Compress() const;
void Decompress() const;
void DeAutogen(); /* If this Notes is autogenerated, make it a real Notes. */
CString GetDescription() const { return Real()->m_sDescription; }
Difficulty GetDifficulty() const { return Real()->m_Difficulty; }
@@ -46,12 +50,6 @@ public:
void SetSMNoteData( const CString &out );
CString GetSMNoteData() const;
// 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
struct MemCardScore
@@ -85,8 +83,6 @@ protected:
int m_iMeter; // difficulty rating from 1-10
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();
};
bool CompareNotesPointersByRadarValues(const Notes* pNotes1, const Notes* pNotes2);
-1
View File
@@ -13,7 +13,6 @@
*/
#include "PrefsManager.h" // for GameplayStatistics
#include "Notes.h"
#include "Sprite.h"
#include "BitmapText.h"
-1
View File
@@ -11,7 +11,6 @@
-----------------------------------------------------------------------------
*/
#include "RageInputDevice.h"
#include "ActorFrame.h"
#include "ScreenMessage.h"
#include "InputFilter.h"
+13 -1
View File
@@ -27,7 +27,7 @@
#include "SDL_keysym.h" // for SDLKeys
#include "ScreenMiniMenu.h"
#include "NoteSkinManager.h"
#include "Notes.h"
#include <utility>
@@ -104,6 +104,8 @@ MiniMenuDefinition g_KeyboardShortcuts =
{ "Home/End: jump to first/last beat", false, 1, 0, {""} },
{ "Ctrl + Up/Down: Change zoom", false, 1, 0, {""} },
{ "Shift + Up/Down: Drag area marker", false, 1, 0, {""} },
{ "P: Play selection", false, 1, 0, {""} },
{ "Ctrl + P: Play whole song", false, 1, 0, {""} },
{ "F7/F8: Decrease/increase BPM at cur beat", false, 1, 0, {""} },
{ "F9/F10: Decrease/increase stop at cur beat", false, 1, 0, {""} },
{ "F11/F12: Decrease/increase music offset", false, 1, 0, {""} },
@@ -896,6 +898,16 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
}
}
break;
case SDLK_p:
{
if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD,SDLK_LCTRL)) ||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD,SDLK_RCTRL)) )
HandleMainMenuChoice( play_whole_song, NULL );
else
if( m_NoteFieldEdit.m_fBeginMarker!=-1 && m_NoteFieldEdit.m_fEndMarker!=-1 )
HandleAreaMenuChoice( play, NULL );
}
break;
}
}
+9 -8
View File
@@ -21,6 +21,7 @@
#include "GameState.h"
#include "RageSoundManager.h"
#include "ThemeManager.h"
#include "Notes.h"
//
@@ -93,7 +94,7 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
switch( SM )
{
case SM_RefreshSelector:
m_Selector.Refresh();
m_Selector.RefreshNotes();
break;
case SM_GoToPrevScreen:
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
@@ -174,8 +175,8 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
break;
case EditMenu::ACTION_DELETE:
ASSERT( pNotes );
SCREENMAN->Prompt( SM_RefreshSelector, "These notes will be lost permanently.\nContinue with delete?", true, false, DeleteCurNotes );
m_Selector.Refresh();
SCREENMAN->Prompt( SM_RefreshSelector, "These notes will be lost permanently.\n\nContinue with delete?", true, false, DeleteCurNotes );
m_Selector.RefreshNotes();
return;
case EditMenu::ACTION_COPY:
ASSERT( !pNotes );
@@ -190,7 +191,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
SCREENMAN->SystemMessage( "Notes created from copy." );
m_soundCreate.PlayRandom();
m_Selector.Refresh();
m_Selector.RefreshNotes();
pSong->Save();
}
return;
@@ -202,13 +203,13 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
// Song allocates all of the other Notes.
Notes* pNewNotes = new Notes;
pNewNotes->AutogenFrom( pSourceNotes, nt );
pNewNotes->BakeAutoGen();
pNewNotes->SetDifficulty( dc );
pNewNotes->DeAutogen();
pNewNotes->SetDifficulty( dc ); // override difficulty with the user's choice
pSong->AddNotes( pNewNotes );
SCREENMAN->SystemMessage( "Notes created from AutoGen." );
m_soundCreate.PlayRandom();
m_Selector.Refresh();
m_Selector.RefreshNotes();
pSong->Save();
}
return;
@@ -225,7 +226,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
SCREENMAN->SystemMessage( "Blank Notes created." );
m_soundCreate.PlayRandom();
m_Selector.Refresh();
m_Selector.RefreshNotes();
pSong->Save();
}
return;
+2 -4
View File
@@ -11,13 +11,9 @@
-----------------------------------------------------------------------------
*/
#include "global.h"
#include "ScreenEz2SelectMusic.h"
#include "RageDisplay.h"
#include <math.h>
#include "SDL.h"
#include "SDL_opengl.h"
#include "ScreenManager.h"
@@ -29,6 +25,8 @@
#include "StyleDef.h"
#include "InputMapper.h"
#include "CodeDetector.h"
#include "Notes.h"
#define SCROLLING_LIST_X THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListX")
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListY")
+1
View File
@@ -21,6 +21,7 @@
#include "RageTimer.h"
#include "ThemeManager.h"
#include "RageDisplay.h"
#include "Screen.h"
ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program
+7 -5
View File
@@ -13,15 +13,17 @@
#include "RageInputDevice.h"
#include "song.h"
#include "Notes.h"
#include "Screen.h"
#include "BitmapText.h"
#include "Quad.h"
#include "ScreenMessage.h"
#include "InputFilter.h"
#include "GameInput.h"
#include "MenuInput.h"
#include "StyleInput.h"
class Screen;
struct MiniMenuDefinition;
class ScreenManager
{
public:
+1
View File
@@ -29,6 +29,7 @@
#include <math.h>
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#include "Notes.h"
#define BANNER_FRAME_X THEME->GetMetricF("ScreenSelectMusic","BannerFrameX")
-1
View File
@@ -21,7 +21,6 @@
-----------------------------------------------------------------------------
*/
#include "Notes.h"
#include "StyleInput.h"
#include "GameInput.h"
#include "Game.h"