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 "XmlFile.h"
#include "LuaBinding.h"
#include "GameManager.h"
REGISTER_ACTOR_CLASS( DifficultyDisplay );
@@ -49,7 +50,7 @@ void DifficultyDisplay::Load( const RString &sType )
m_iMaxTicks.Load(sType,"MaxTicks");
m_bShowTicks.Load(sType,"ShowTicks");
m_bShowMeter.Load(sType,"ShowMeter");
m_bShowEditDescription.Load(sType,"ShowEditDescription");
m_bShowDescription.Load(sType,"ShowDescription");
m_sZeroMeterString.Load(sType,"ZeroMeterString");
@@ -78,13 +79,19 @@ void DifficultyDisplay::Load( const RString &sType )
ASSERT( m_textMeter.HasCommand("Set") );
}
if( m_bShowEditDescription )
if( m_bShowDescription )
{
m_textEditDescription.SetName( "EditDescription" );
m_textEditDescription.LoadFromFont( THEME->GetPathF(sType,"EditDescription") );
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_textEditDescription, sType );
this->AddChild( &m_textEditDescription );
m_textDescription.SetName( "Description" );
m_textDescription.LoadFromFont( THEME->GetPathF(sType,"Description") );
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_textDescription, sType );
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();
}
@@ -172,7 +179,7 @@ void DifficultyDisplay::SetInternal( const SetParams &params )
msg.SetParam( "StepsType", params.st );
msg.SetParam( "Difficulty", params.dc );
msg.SetParam( "IsCourseDifficulty", params.bIsCourseDifficulty );
msg.SetParam( "EditDescription", params.sEditDescription );
msg.SetParam( "Description", params.sDescription );
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 )
{
m_textEditDescription.SetVisible( true );
m_textEditDescription.SetText( params.sEditDescription );
}
m_textDescription.SetText( params.sDescription );
else if( params.bIsCourseDifficulty )
m_textDescription.SetText( CourseDifficultyToLocalizedString(params.dc) );
else
{
m_textEditDescription.SetVisible( false );
}
m_textDescription.SetText( DifficultyToLocalizedString(params.dc) );
}
this->HandleMessage( msg );
+5 -4
View File
@@ -21,8 +21,8 @@ public:
DifficultyDisplay();
void Load( const RString &sType );
void LoadFromNode( const XNode* pNode );
virtual DifficultyDisplay *Copy() const;
void SetFromGameState( PlayerNumber pn );
@@ -44,20 +44,21 @@ private:
StepsType st;
Difficulty dc;
bool bIsCourseDifficulty;
RString sEditDescription;
RString sDescription;
};
void SetInternal( const SetParams &params );
AutoActor m_sprFrame;
BitmapText m_textTicks; /* 111100000 */
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_iMaxTicks;
ThemeMetric<bool> m_bShowTicks;
ThemeMetric<bool> m_bShowMeter;
ThemeMetric<bool> m_bShowEditDescription;
ThemeMetric<bool> m_bShowDescription;
ThemeMetric<RString> m_sZeroMeterString;
};
+17 -15
View File
@@ -49,7 +49,6 @@
#include "Game.h"
#include "ActiveAttackList.h"
#include "Player.h"
#include "DifficultyIcon.h"
#include "DifficultyDisplay.h"
#include "XmlFile.h"
#include "Background.h"
@@ -116,7 +115,7 @@ PlayerInfo::PlayerInfo()
m_pActiveAttackList = NULL;
m_pPlayer = NULL;
m_pInventory = NULL;
m_pDifficultyIcon = NULL;
m_pDifficultyDisplay = NULL;
}
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_pPlayer = new Player( m_NoteData, bShowNoteField );
m_pInventory = NULL;
m_pDifficultyIcon = NULL;
m_pDifficultyDisplay = NULL;
if( IsMultiPlayer() )
{
@@ -221,7 +220,7 @@ PlayerInfo::~PlayerInfo()
SAFE_DELETE( m_pActiveAttackList );
SAFE_DELETE( m_pPlayer );
SAFE_DELETE( m_pInventory );
SAFE_DELETE( m_pDifficultyIcon );
SAFE_DELETE( m_pDifficultyDisplay );
}
void PlayerInfo::ShowOniGameOver()
@@ -624,12 +623,15 @@ void ScreenGameplay::Init()
//
// Difficulty icon and meter
//
ASSERT( pi->m_pDifficultyIcon == NULL );
pi->m_pDifficultyIcon = new DifficultyIcon;
pi->m_pDifficultyIcon->Load( THEME->GetPathG(m_sName,ssprintf("difficulty icons %dx%d",NUM_PLAYERS,NUM_Difficulty)) );
pi->m_pDifficultyIcon->SetName( ssprintf("Difficulty%s",pi->GetName().c_str()) );
LOAD_ALL_COMMANDS( pi->m_pDifficultyIcon );
this->AddChild( pi->m_pDifficultyIcon );
ASSERT( pi->m_pDifficultyDisplay == NULL );
pi->m_pDifficultyDisplay = new DifficultyDisplay;
pi->m_pDifficultyDisplay->Load("DifficultyDisplayGameplay");
pi->m_pDifficultyDisplay->SetName( ssprintf("DifficultyDisplay%s",pi->GetName().c_str()) );
PlayerNumber pn = pi->GetStepsAndTrailIndex();
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 )
// {
@@ -1074,8 +1076,8 @@ void ScreenGameplay::LoadNextSong()
if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType==SongOptions::LIFE_BAR && pi->m_pLifeMeter )
pi->m_pLifeMeter->UpdateNonstopLifebar();
if( pi->m_pDifficultyIcon )
pi->m_pDifficultyIcon->SetFromSteps( pi->GetStepsAndTrailIndex(), pSteps );
if( pi->m_pDifficultyDisplay )
pi->m_pDifficultyDisplay->SetFromSteps( pSteps );
/* 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. */
@@ -1122,8 +1124,8 @@ void ScreenGameplay::LoadNextSong()
{
bool bReverse = pi->GetPlayerState()->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1;
if( pi->m_pDifficultyIcon )
pi->m_pDifficultyIcon->PlayCommand( bReverse? "SetReverse":"SetNoReverse" );
if( pi->m_pDifficultyDisplay )
pi->m_pDifficultyDisplay->PlayCommand( bReverse? "SetReverse":"SetNoReverse" );
}
m_LyricDisplay.PlayCommand( bAllReverse? "SetReverse": bAtLeastOneReverse? "SetOneReverse": "SetNoReverse" );
@@ -1283,7 +1285,7 @@ void ScreenGameplay::LoadLights()
/* 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 )
+2 -2
View File
@@ -27,7 +27,7 @@ class CombinedLifeMeter;
class Player;
class LifeMeter;
class ScoreDisplay;
class DifficultyIcon;
class DifficultyDisplay;
class Inventory;
class ScoreKeeper;
class Background;
@@ -98,7 +98,7 @@ public:
// used in PLAY_MODE_BATTLE
Inventory *m_pInventory;
DifficultyIcon *m_pDifficultyIcon;
DifficultyDisplay *m_pDifficultyDisplay;
AutoActor m_sprOniGameOver;
};