EditDescription -> Description, set Description to either EditDescription or the localized difficulty string, add AutoGen icon, use DifficultyDisplay in Gameplay

This commit is contained in:
Chris Danford
2008-03-24 04:38:14 +00:00
parent 779b23e565
commit 36c553b0a3
4 changed files with 43 additions and 36 deletions
+19 -15
View File
@@ -11,6 +11,7 @@
#include "Style.h" #include "Style.h"
#include "XmlFile.h" #include "XmlFile.h"
#include "LuaBinding.h" #include "LuaBinding.h"
#include "GameManager.h"
REGISTER_ACTOR_CLASS( DifficultyDisplay ); REGISTER_ACTOR_CLASS( DifficultyDisplay );
@@ -49,7 +50,7 @@ void DifficultyDisplay::Load( const RString &sType )
m_iMaxTicks.Load(sType,"MaxTicks"); m_iMaxTicks.Load(sType,"MaxTicks");
m_bShowTicks.Load(sType,"ShowTicks"); m_bShowTicks.Load(sType,"ShowTicks");
m_bShowMeter.Load(sType,"ShowMeter"); m_bShowMeter.Load(sType,"ShowMeter");
m_bShowEditDescription.Load(sType,"ShowEditDescription"); m_bShowDescription.Load(sType,"ShowDescription");
m_sZeroMeterString.Load(sType,"ZeroMeterString"); m_sZeroMeterString.Load(sType,"ZeroMeterString");
@@ -78,14 +79,20 @@ void DifficultyDisplay::Load( const RString &sType )
ASSERT( m_textMeter.HasCommand("Set") ); ASSERT( m_textMeter.HasCommand("Set") );
} }
if( m_bShowEditDescription ) if( m_bShowDescription )
{ {
m_textEditDescription.SetName( "EditDescription" ); m_textDescription.SetName( "Description" );
m_textEditDescription.LoadFromFont( THEME->GetPathF(sType,"EditDescription") ); m_textDescription.LoadFromFont( THEME->GetPathF(sType,"Description") );
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_textEditDescription, sType ); ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_textDescription, sType );
this->AddChild( &m_textEditDescription ); this->AddChild( &m_textDescription );
} }
m_sprAutogen.Load( THEME->GetPathG(sType,"Autogen") );
m_sprAutogen->SetName( "Autogen" );
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_sprAutogen, sType );
this->AddChild( m_sprAutogen );
Unset(); Unset();
} }
@@ -172,7 +179,7 @@ void DifficultyDisplay::SetInternal( const SetParams &params )
msg.SetParam( "StepsType", params.st ); msg.SetParam( "StepsType", params.st );
msg.SetParam( "Difficulty", params.dc ); msg.SetParam( "Difficulty", params.dc );
msg.SetParam( "IsCourseDifficulty", params.bIsCourseDifficulty ); msg.SetParam( "IsCourseDifficulty", params.bIsCourseDifficulty );
msg.SetParam( "EditDescription", params.sEditDescription ); msg.SetParam( "Description", params.sDescription );
m_sprFrame->HandleMessage( msg ); m_sprFrame->HandleMessage( msg );
@@ -202,17 +209,14 @@ void DifficultyDisplay::SetInternal( const SetParams &params )
} }
} }
if( m_bShowEditDescription ) if( m_bShowDescription )
{ {
if( params.dc == Difficulty_Edit ) if( params.dc == Difficulty_Edit )
{ m_textDescription.SetText( params.sDescription );
m_textEditDescription.SetVisible( true ); else if( params.bIsCourseDifficulty )
m_textEditDescription.SetText( params.sEditDescription ); m_textDescription.SetText( CourseDifficultyToLocalizedString(params.dc) );
}
else else
{ m_textDescription.SetText( DifficultyToLocalizedString(params.dc) );
m_textEditDescription.SetVisible( false );
}
} }
this->HandleMessage( msg ); this->HandleMessage( msg );
+5 -4
View File
@@ -21,8 +21,8 @@ public:
DifficultyDisplay(); DifficultyDisplay();
void Load( const RString &sType ); void Load( const RString &sType );
void LoadFromNode( const XNode* pNode ); void LoadFromNode( const XNode* pNode );
virtual DifficultyDisplay *Copy() const; virtual DifficultyDisplay *Copy() const;
void SetFromGameState( PlayerNumber pn ); void SetFromGameState( PlayerNumber pn );
@@ -44,20 +44,21 @@ private:
StepsType st; StepsType st;
Difficulty dc; Difficulty dc;
bool bIsCourseDifficulty; bool bIsCourseDifficulty;
RString sEditDescription; RString sDescription;
}; };
void SetInternal( const SetParams &params ); void SetInternal( const SetParams &params );
AutoActor m_sprFrame; AutoActor m_sprFrame;
BitmapText m_textTicks; /* 111100000 */ BitmapText m_textTicks; /* 111100000 */
BitmapText m_textMeter; /* 3, 9 */ BitmapText m_textMeter; /* 3, 9 */
BitmapText m_textEditDescription; BitmapText m_textDescription; /* Easy, Medium, SuperCoolEdit */
AutoActor m_sprAutogen; // visible if Steps and is autogen'd
ThemeMetric<int> m_iNumTicks; ThemeMetric<int> m_iNumTicks;
ThemeMetric<int> m_iMaxTicks; ThemeMetric<int> m_iMaxTicks;
ThemeMetric<bool> m_bShowTicks; ThemeMetric<bool> m_bShowTicks;
ThemeMetric<bool> m_bShowMeter; ThemeMetric<bool> m_bShowMeter;
ThemeMetric<bool> m_bShowEditDescription; ThemeMetric<bool> m_bShowDescription;
ThemeMetric<RString> m_sZeroMeterString; ThemeMetric<RString> m_sZeroMeterString;
}; };
+17 -15
View File
@@ -49,7 +49,6 @@
#include "Game.h" #include "Game.h"
#include "ActiveAttackList.h" #include "ActiveAttackList.h"
#include "Player.h" #include "Player.h"
#include "DifficultyIcon.h"
#include "DifficultyDisplay.h" #include "DifficultyDisplay.h"
#include "XmlFile.h" #include "XmlFile.h"
#include "Background.h" #include "Background.h"
@@ -116,7 +115,7 @@ PlayerInfo::PlayerInfo()
m_pActiveAttackList = NULL; m_pActiveAttackList = NULL;
m_pPlayer = NULL; m_pPlayer = NULL;
m_pInventory = NULL; m_pInventory = NULL;
m_pDifficultyIcon = NULL; m_pDifficultyDisplay = NULL;
} }
void PlayerInfo::Load( PlayerNumber pn, MultiPlayer mp, bool bShowNoteField, int iAddToDifficulty ) void PlayerInfo::Load( PlayerNumber pn, MultiPlayer mp, bool bShowNoteField, int iAddToDifficulty )
@@ -185,7 +184,7 @@ void PlayerInfo::Load( PlayerNumber pn, MultiPlayer mp, bool bShowNoteField, int
m_pActiveAttackList = NULL; m_pActiveAttackList = NULL;
m_pPlayer = new Player( m_NoteData, bShowNoteField ); m_pPlayer = new Player( m_NoteData, bShowNoteField );
m_pInventory = NULL; m_pInventory = NULL;
m_pDifficultyIcon = NULL; m_pDifficultyDisplay = NULL;
if( IsMultiPlayer() ) if( IsMultiPlayer() )
{ {
@@ -221,7 +220,7 @@ PlayerInfo::~PlayerInfo()
SAFE_DELETE( m_pActiveAttackList ); SAFE_DELETE( m_pActiveAttackList );
SAFE_DELETE( m_pPlayer ); SAFE_DELETE( m_pPlayer );
SAFE_DELETE( m_pInventory ); SAFE_DELETE( m_pInventory );
SAFE_DELETE( m_pDifficultyIcon ); SAFE_DELETE( m_pDifficultyDisplay );
} }
void PlayerInfo::ShowOniGameOver() void PlayerInfo::ShowOniGameOver()
@@ -624,12 +623,15 @@ void ScreenGameplay::Init()
// //
// Difficulty icon and meter // Difficulty icon and meter
// //
ASSERT( pi->m_pDifficultyIcon == NULL ); ASSERT( pi->m_pDifficultyDisplay == NULL );
pi->m_pDifficultyIcon = new DifficultyIcon; pi->m_pDifficultyDisplay = new DifficultyDisplay;
pi->m_pDifficultyIcon->Load( THEME->GetPathG(m_sName,ssprintf("difficulty icons %dx%d",NUM_PLAYERS,NUM_Difficulty)) ); pi->m_pDifficultyDisplay->Load("DifficultyDisplayGameplay");
pi->m_pDifficultyIcon->SetName( ssprintf("Difficulty%s",pi->GetName().c_str()) ); pi->m_pDifficultyDisplay->SetName( ssprintf("DifficultyDisplay%s",pi->GetName().c_str()) );
LOAD_ALL_COMMANDS( pi->m_pDifficultyIcon ); PlayerNumber pn = pi->GetStepsAndTrailIndex();
this->AddChild( pi->m_pDifficultyIcon ); if( pn != PlayerNumber_Invalid )
pi->m_pDifficultyDisplay->PlayCommand( "Set" + pi->GetName() );
LOAD_ALL_COMMANDS( pi->m_pDifficultyDisplay );
this->AddChild( pi->m_pDifficultyDisplay );
// switch( GAMESTATE->m_PlayMode ) // switch( GAMESTATE->m_PlayMode )
// { // {
@@ -1074,8 +1076,8 @@ void ScreenGameplay::LoadNextSong()
if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType==SongOptions::LIFE_BAR && pi->m_pLifeMeter ) if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType==SongOptions::LIFE_BAR && pi->m_pLifeMeter )
pi->m_pLifeMeter->UpdateNonstopLifebar(); pi->m_pLifeMeter->UpdateNonstopLifebar();
if( pi->m_pDifficultyIcon ) if( pi->m_pDifficultyDisplay )
pi->m_pDifficultyIcon->SetFromSteps( pi->GetStepsAndTrailIndex(), pSteps ); pi->m_pDifficultyDisplay->SetFromSteps( pSteps );
/* The actual note data for scoring is the base class of Player. This includes /* The actual note data for scoring is the base class of Player. This includes
* transforms, like Wide. Otherwise, the scoring will operate on the wrong data. */ * transforms, like Wide. Otherwise, the scoring will operate on the wrong data. */
@@ -1122,8 +1124,8 @@ void ScreenGameplay::LoadNextSong()
{ {
bool bReverse = pi->GetPlayerState()->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1; bool bReverse = pi->GetPlayerState()->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1;
if( pi->m_pDifficultyIcon ) if( pi->m_pDifficultyDisplay )
pi->m_pDifficultyIcon->PlayCommand( bReverse? "SetReverse":"SetNoReverse" ); pi->m_pDifficultyDisplay->PlayCommand( bReverse? "SetReverse":"SetNoReverse" );
} }
m_LyricDisplay.PlayCommand( bAllReverse? "SetReverse": bAtLeastOneReverse? "SetOneReverse": "SetNoReverse" ); m_LyricDisplay.PlayCommand( bAllReverse? "SetReverse": bAtLeastOneReverse? "SetOneReverse": "SetNoReverse" );
@@ -1283,7 +1285,7 @@ void ScreenGameplay::LoadLights()
/* fall through */ /* fall through */
} }
NoteDataUtil::LoadTransformedLights( TapNoteData1, m_CabinetLightsNoteData, GameManager::StepsTypeToNumTracks(STEPS_TYPE_LIGHTS_CABINET) ); NoteDataUtil::LoadTransformedLights( TapNoteData1, m_CabinetLightsNoteData, GAMEMAN->GetStepsTypeInfo(STEPS_TYPE_LIGHTS_CABINET).iNumTracks );
} }
void ScreenGameplay::StartPlayingSong( float fMinTimeToNotes, float fMinTimeToMusic ) void ScreenGameplay::StartPlayingSong( float fMinTimeToNotes, float fMinTimeToMusic )
+2 -2
View File
@@ -27,7 +27,7 @@ class CombinedLifeMeter;
class Player; class Player;
class LifeMeter; class LifeMeter;
class ScoreDisplay; class ScoreDisplay;
class DifficultyIcon; class DifficultyDisplay;
class Inventory; class Inventory;
class ScoreKeeper; class ScoreKeeper;
class Background; class Background;
@@ -98,7 +98,7 @@ public:
// used in PLAY_MODE_BATTLE // used in PLAY_MODE_BATTLE
Inventory *m_pInventory; Inventory *m_pInventory;
DifficultyIcon *m_pDifficultyIcon; DifficultyDisplay *m_pDifficultyDisplay;
AutoActor m_sprOniGameOver; AutoActor m_sprOniGameOver;
}; };