[BeginnerHelper] Changed Player_#X/Y metrics to Player#X/Y metrics for consistency.
Converted the background to an AutoActor. Renamed Initialize -> Init for consistency.
This commit is contained in:
@@ -13,6 +13,12 @@ _____________________________________________________________________________
|
|||||||
sm-ssc v1.2.5 | 201104??
|
sm-ssc v1.2.5 | 201104??
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
20110428
|
||||||
|
--------
|
||||||
|
* [BeginnerHelper] Various changes: [AJ]
|
||||||
|
* Changed Player_#X/Y metrics to Player#X/Y metrics for consistency.
|
||||||
|
* Converted the background to an AutoActor.
|
||||||
|
|
||||||
20110423
|
20110423
|
||||||
--------
|
--------
|
||||||
* [CourseLoaderCRS] Fixed loading of Player's Best/Most Played courses,
|
* [CourseLoaderCRS] Fixed loading of Player's Best/Most Played courses,
|
||||||
|
|||||||
+112
-101
@@ -12,12 +12,12 @@
|
|||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
|
||||||
// "PLAYER_X" offsets are relative to the pad.. ex: Setting this to 10, and the HELPER to 300, will put the dancer at 310
|
// "PLAYER_X" offsets are relative to the pad. ex: Setting this to 10, and the HELPER to 300, will put the dancer at 310
|
||||||
#define PLAYER_X( px ) THEME->GetMetricF("BeginnerHelper",ssprintf("Player%d_X",px+1))
|
#define PLAYER_X( px ) THEME->GetMetricF("BeginnerHelper",ssprintf("Player%dX",px+1))
|
||||||
#define PLAYER_ANGLE THEME->GetMetricF("BeginnerHelper","PlayerAngle")
|
#define PLAYER_ANGLE THEME->GetMetricF("BeginnerHelper","PlayerAngle")
|
||||||
#define DANCEPAD_ANGLE THEME->GetMetricF("BeginnerHelper","DancePadAngle")
|
#define DANCEPAD_ANGLE THEME->GetMetricF("BeginnerHelper","DancePadAngle")
|
||||||
|
|
||||||
// "HELPER" offsets effect the pad/dancer as a whole.. Their relative Y cooridinates are hard-coded for eachother.
|
// "HELPER" offsets effect the pad/dancer as a whole. Their relative Y cooridinates are hard-coded for each other.
|
||||||
#define HELPER_X THEME->GetMetricF("BeginnerHelper","HelperX")
|
#define HELPER_X THEME->GetMetricF("BeginnerHelper","HelperX")
|
||||||
#define HELPER_Y THEME->GetMetricF("BeginnerHelper","HelperY")
|
#define HELPER_Y THEME->GetMetricF("BeginnerHelper","HelperY")
|
||||||
|
|
||||||
@@ -75,6 +75,108 @@ BeginnerHelper::~BeginnerHelper()
|
|||||||
delete m_pDancePad;
|
delete m_pDancePad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BeginnerHelper::Init( int iDancePadType )
|
||||||
|
{
|
||||||
|
ASSERT( !m_bInitialized );
|
||||||
|
if( !CanUse() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// If no players were successfully added, bail.
|
||||||
|
{
|
||||||
|
bool bAnyLoaded = false;
|
||||||
|
for( int pn=0; pn<NUM_PLAYERS; pn++ )
|
||||||
|
if( m_bPlayerEnabled[pn] )
|
||||||
|
bAnyLoaded = true;
|
||||||
|
|
||||||
|
if( !bAnyLoaded )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the Background and flash. Flash only shows if the BG does.
|
||||||
|
if( m_bShowBackground )
|
||||||
|
{
|
||||||
|
m_sBackground.Load( THEME->GetPathG("BeginnerHelper","background") );
|
||||||
|
this->AddChild( m_sBackground );
|
||||||
|
//m_sBackground.SetXY( 1, 1 );
|
||||||
|
|
||||||
|
m_sFlash.Load( THEME->GetPathG("BeginnerHelper","flash") );
|
||||||
|
m_sFlash.SetXY( 0, 0 );
|
||||||
|
m_sFlash.SetDiffuseAlpha( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load StepCircle graphics
|
||||||
|
for( int lsc=0; lsc<NUM_PLAYERS; lsc++ )
|
||||||
|
{
|
||||||
|
for( int lsce=0; lsce<4; lsce++ )
|
||||||
|
{
|
||||||
|
m_sStepCircle[lsc][lsce].Load( THEME->GetPathG("BeginnerHelper","stepcircle") );
|
||||||
|
m_sStepCircle[lsc][lsce].SetZoom( 0 ); // Hide until needed.
|
||||||
|
this->AddChild(&m_sStepCircle[lsc][lsce]);
|
||||||
|
|
||||||
|
// Set StepCircle coordinates
|
||||||
|
switch( lsce )
|
||||||
|
{
|
||||||
|
case 0: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)-80),HELPER_Y); break; // Left
|
||||||
|
case 1: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)+80),HELPER_Y); break; // Right
|
||||||
|
case 2: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y-60)); break; // Up
|
||||||
|
case 3: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y+60)); break; // Down
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SHOW_DANCE_PAD.Load( "BeginnerHelper","ShowDancePad" );
|
||||||
|
// Load the DancePad
|
||||||
|
if( SHOW_DANCE_PAD )
|
||||||
|
{
|
||||||
|
switch( iDancePadType )
|
||||||
|
{
|
||||||
|
case 0: break; // No pad
|
||||||
|
case 1: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break;
|
||||||
|
case 2: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pDancePad->SetHorizAlign( align_left ); // xxx: hardcoded -aj
|
||||||
|
m_pDancePad->SetRotationX( DANCEPAD_ANGLE );
|
||||||
|
m_pDancePad->SetX( HELPER_X );
|
||||||
|
m_pDancePad->SetY( HELPER_Y );
|
||||||
|
// xxx: hardcoded -aj
|
||||||
|
m_pDancePad->SetZoom( 23 ); // Pad should always be 3 units bigger in zoom than the dancer.
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int pl=0; pl<NUM_PLAYERS; pl++ ) // Load players
|
||||||
|
{
|
||||||
|
// Skip if not enabled
|
||||||
|
if( !m_bPlayerEnabled[pl] )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Load character data
|
||||||
|
const Character *Character = GAMESTATE->m_pCurCharacters[pl];
|
||||||
|
ASSERT( Character != NULL );
|
||||||
|
|
||||||
|
// Load textures
|
||||||
|
m_pDancer[pl]->SetHorizAlign( align_left );
|
||||||
|
m_pDancer[pl]->LoadMilkshapeAscii( Character->GetModelPath() );
|
||||||
|
|
||||||
|
// Load needed animations
|
||||||
|
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-LEFT", GetAnimPath(ANIM_LEFT) );
|
||||||
|
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath(ANIM_DOWN) );
|
||||||
|
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath(ANIM_UP) );
|
||||||
|
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath(ANIM_RIGHT) );
|
||||||
|
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath(ANIM_JUMPLR) );
|
||||||
|
m_pDancer[pl]->LoadMilkshapeAsciiBones( "rest", Character->GetRestAnimationPath() );
|
||||||
|
m_pDancer[pl]->SetDefaultAnimation( "rest" ); // Stay bouncing after a step has finished animating
|
||||||
|
m_pDancer[pl]->PlayAnimation( "rest" );
|
||||||
|
m_pDancer[pl]->SetRotationX( PLAYER_ANGLE );
|
||||||
|
m_pDancer[pl]->SetX( HELPER_X+PLAYER_X(pl) );
|
||||||
|
m_pDancer[pl]->SetY( HELPER_Y+10 );
|
||||||
|
m_pDancer[pl]->SetZoom( 20 );
|
||||||
|
m_pDancer[pl]->SetCullMode( CULL_NONE ); // many of the models floating around have the vertex order flipped
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bInitialized = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void BeginnerHelper::ShowStepCircle( PlayerNumber pn, int CSTEP )
|
void BeginnerHelper::ShowStepCircle( PlayerNumber pn, int CSTEP )
|
||||||
{
|
{
|
||||||
int isc=0; // Save OR issues within array boundries.. it's worth the extra few bytes of memory.
|
int isc=0; // Save OR issues within array boundries.. it's worth the extra few bytes of memory.
|
||||||
@@ -120,102 +222,6 @@ bool BeginnerHelper::CanUse()
|
|||||||
return GAMESTATE->GetCurrentStyle()->m_bCanUseBeginnerHelper;
|
return GAMESTATE->GetCurrentStyle()->m_bCanUseBeginnerHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BeginnerHelper::Initialize( int iDancePadType )
|
|
||||||
{
|
|
||||||
ASSERT( !m_bInitialized );
|
|
||||||
if( !CanUse() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// If no players were successfully added, bail.
|
|
||||||
{
|
|
||||||
bool bAnyLoaded = false;
|
|
||||||
for( int pn=0; pn<NUM_PLAYERS; pn++ )
|
|
||||||
if( m_bPlayerEnabled[pn] )
|
|
||||||
bAnyLoaded = true;
|
|
||||||
|
|
||||||
if( !bAnyLoaded )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the Background and flash.. Flash only shows if the BG does.
|
|
||||||
if( m_bShowBackground )
|
|
||||||
{
|
|
||||||
m_sBackground.Load( THEME->GetPathG("BeginnerHelper","background") );
|
|
||||||
this->AddChild( &m_sBackground );
|
|
||||||
m_sBackground.SetXY( 1, 1 );
|
|
||||||
m_sFlash.Load( THEME->GetPathG("BeginnerHelper","flash") );
|
|
||||||
m_sFlash.SetXY( 0, 0 );
|
|
||||||
m_sFlash.SetDiffuseAlpha( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load StepCircle graphics
|
|
||||||
for( int lsc=0; lsc<NUM_PLAYERS; lsc++ )
|
|
||||||
{
|
|
||||||
for( int lsce=0; lsce<4; lsce++ )
|
|
||||||
{
|
|
||||||
m_sStepCircle[lsc][lsce].Load( THEME->GetPathG("BeginnerHelper","stepcircle") );
|
|
||||||
m_sStepCircle[lsc][lsce].SetZoom( 0 ); // Hide until needed.
|
|
||||||
this->AddChild(&m_sStepCircle[lsc][lsce]);
|
|
||||||
|
|
||||||
// Set coordinates of StepCircle
|
|
||||||
switch( lsce )
|
|
||||||
{
|
|
||||||
case 0: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)-80),HELPER_Y); break; // Left
|
|
||||||
case 1: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)+80),HELPER_Y); break; // Right
|
|
||||||
case 2: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y-60)); break; // Up
|
|
||||||
case 3: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y+60)); break; // Down
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the DancePad
|
|
||||||
switch( iDancePadType )
|
|
||||||
{
|
|
||||||
case 0: break; // No pad
|
|
||||||
case 1: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break;
|
|
||||||
case 2: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pDancePad->SetHorizAlign( align_left );
|
|
||||||
m_pDancePad->SetRotationX( DANCEPAD_ANGLE );
|
|
||||||
m_pDancePad->SetX( HELPER_X );
|
|
||||||
m_pDancePad->SetY( HELPER_Y );
|
|
||||||
m_pDancePad->SetZoom( 23 ); // Pad should always be 3 units bigger in zoom than the dancer.
|
|
||||||
|
|
||||||
for( int pl=0; pl<NUM_PLAYERS; pl++ ) // Load players
|
|
||||||
{
|
|
||||||
// Skip if not enabled
|
|
||||||
if( !m_bPlayerEnabled[pl] )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Load character data
|
|
||||||
const Character *Character = GAMESTATE->m_pCurCharacters[pl];
|
|
||||||
ASSERT( Character != NULL );
|
|
||||||
|
|
||||||
// Load textures
|
|
||||||
m_pDancer[pl]->SetHorizAlign( align_left );
|
|
||||||
m_pDancer[pl]->LoadMilkshapeAscii( Character->GetModelPath() );
|
|
||||||
|
|
||||||
// Load needed animations
|
|
||||||
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-LEFT", GetAnimPath(ANIM_LEFT) );
|
|
||||||
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-DOWN", GetAnimPath(ANIM_DOWN) );
|
|
||||||
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-UP", GetAnimPath(ANIM_UP) );
|
|
||||||
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-RIGHT", GetAnimPath(ANIM_RIGHT) );
|
|
||||||
m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-JUMPLR", GetAnimPath(ANIM_JUMPLR) );
|
|
||||||
m_pDancer[pl]->LoadMilkshapeAsciiBones( "rest", Character->GetRestAnimationPath() );
|
|
||||||
m_pDancer[pl]->SetDefaultAnimation( "rest" ); // Stay bouncing after a step has finished animating
|
|
||||||
m_pDancer[pl]->PlayAnimation( "rest" );
|
|
||||||
m_pDancer[pl]->SetRotationX( PLAYER_ANGLE );
|
|
||||||
m_pDancer[pl]->SetX( HELPER_X+PLAYER_X(pl) );
|
|
||||||
m_pDancer[pl]->SetY( HELPER_Y+10 );
|
|
||||||
m_pDancer[pl]->SetZoom( 20 );
|
|
||||||
m_pDancer[pl]->SetCullMode( CULL_NONE ); // many of the models floating around have the vertex order flipped
|
|
||||||
}
|
|
||||||
|
|
||||||
m_bInitialized = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BeginnerHelper::DrawPrimitives()
|
void BeginnerHelper::DrawPrimitives()
|
||||||
{
|
{
|
||||||
// If not initialized, don't bother with this
|
// If not initialized, don't bother with this
|
||||||
@@ -226,6 +232,9 @@ void BeginnerHelper::DrawPrimitives()
|
|||||||
m_sFlash.Draw();
|
m_sFlash.Draw();
|
||||||
|
|
||||||
bool DrawCelShaded = PREFSMAN->m_bCelShadeModels;
|
bool DrawCelShaded = PREFSMAN->m_bCelShadeModels;
|
||||||
|
// Draw Pad
|
||||||
|
if( SHOW_DANCE_PAD )
|
||||||
|
{
|
||||||
if( DrawCelShaded )
|
if( DrawCelShaded )
|
||||||
m_pDancePad->DrawCelShaded();
|
m_pDancePad->DrawCelShaded();
|
||||||
else
|
else
|
||||||
@@ -243,15 +252,17 @@ void BeginnerHelper::DrawPrimitives()
|
|||||||
DISPLAY->SetLightOff( 0 );
|
DISPLAY->SetLightOff( 0 );
|
||||||
DISPLAY->SetLighting( false );
|
DISPLAY->SetLighting( false );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Draw StepCircles
|
// Draw StepCircles
|
||||||
for(int scd=0; scd<NUM_PLAYERS; scd++)
|
for(int scd=0; scd<NUM_PLAYERS; scd++)
|
||||||
for(int scde=0; scde<4; scde++)
|
for(int scde=0; scde<4; scde++)
|
||||||
m_sStepCircle[scd][scde].Draw();
|
m_sStepCircle[scd][scde].Draw();
|
||||||
|
|
||||||
|
// Draw Dancers
|
||||||
if( DrawCelShaded )
|
if( DrawCelShaded )
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( pn ) // Draw each dancer
|
FOREACH_PlayerNumber( pn )
|
||||||
if( GAMESTATE->IsHumanPlayer(pn) )
|
if( GAMESTATE->IsHumanPlayer(pn) )
|
||||||
m_pDancer[pn]->DrawCelShaded();
|
m_pDancer[pn]->DrawCelShaded();
|
||||||
}
|
}
|
||||||
@@ -265,7 +276,7 @@ void BeginnerHelper::DrawPrimitives()
|
|||||||
RageColor(0,0,0,1),
|
RageColor(0,0,0,1),
|
||||||
RageVector3(0, 0, 1) );
|
RageVector3(0, 0, 1) );
|
||||||
|
|
||||||
FOREACH_PlayerNumber( pn ) // Draw each dancer
|
FOREACH_PlayerNumber( pn )
|
||||||
if( GAMESTATE->IsHumanPlayer(pn) )
|
if( GAMESTATE->IsHumanPlayer(pn) )
|
||||||
m_pDancer[pn]->Draw();
|
m_pDancer[pn]->Draw();
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,10 @@
|
|||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
|
#include "AutoActor.h"
|
||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "NoteData.h"
|
#include "NoteData.h"
|
||||||
|
#include "ThemeMetric.h"
|
||||||
class Model;
|
class Model;
|
||||||
/** @brief A dancing character that follows the steps of the Song. */
|
/** @brief A dancing character that follows the steps of the Song. */
|
||||||
class BeginnerHelper : public ActorFrame
|
class BeginnerHelper : public ActorFrame
|
||||||
@@ -14,7 +16,7 @@ public:
|
|||||||
BeginnerHelper();
|
BeginnerHelper();
|
||||||
~BeginnerHelper();
|
~BeginnerHelper();
|
||||||
|
|
||||||
bool Initialize( int iDancePadType );
|
bool Init( int iDancePadType );
|
||||||
bool IsInitialized() { return m_bInitialized; }
|
bool IsInitialized() { return m_bInitialized; }
|
||||||
static bool CanUse();
|
static bool CanUse();
|
||||||
void AddPlayer( PlayerNumber pn, const NoteData &nd );
|
void AddPlayer( PlayerNumber pn, const NoteData &nd );
|
||||||
@@ -32,12 +34,14 @@ protected:
|
|||||||
Model *m_pDancer[NUM_PLAYERS];
|
Model *m_pDancer[NUM_PLAYERS];
|
||||||
Model *m_pDancePad;
|
Model *m_pDancePad;
|
||||||
Sprite m_sFlash;
|
Sprite m_sFlash;
|
||||||
Sprite m_sBackground;
|
AutoActor m_sBackground;
|
||||||
Sprite m_sStepCircle[NUM_PLAYERS][4]; // More memory, but much easier to manage
|
Sprite m_sStepCircle[NUM_PLAYERS][4]; // More memory, but much easier to manage
|
||||||
|
|
||||||
int m_iLastRowChecked;
|
int m_iLastRowChecked;
|
||||||
int m_iLastRowFlashed;
|
int m_iLastRowFlashed;
|
||||||
bool m_bInitialized;
|
bool m_bInitialized;
|
||||||
|
|
||||||
|
ThemeMetric<bool> SHOW_DANCE_PAD;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user