Re-Vamped BeginnerHelper to use StepCircles and more.
This commit is contained in:
+120
-136
@@ -14,12 +14,6 @@
|
|||||||
#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")
|
||||||
|
|
||||||
// STEPCIRCLE commands are relative to the HELPER position
|
|
||||||
#define STEPCIRCLE_LEFT_COMMAND( pz ) THEME->GetMetric ("BeginnerHelper",ssprintf("StepCircleP%d_LEFT_COMMAND",pz+1))
|
|
||||||
#define STEPCIRCLE_DOWN_COMMAND( pz ) THEME->GetMetric ("BeginnerHelper",ssprintf("StepCircleP%d_DOWN_COMMAND",pz+1))
|
|
||||||
#define STEPCIRCLE_UP_COMMAND( pz ) THEME->GetMetric ("BeginnerHelper",ssprintf("StepCircleP%d_UP_COMMAND",pz+1))
|
|
||||||
#define STEPCIRCLE_RIGHT_COMMAND( pz ) THEME->GetMetric ("BeginnerHelper",ssprintf("StepCircleP%d_RIGHT_COMMAND",pz+1))
|
|
||||||
|
|
||||||
// "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 eachother.
|
||||||
#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")
|
||||||
@@ -54,71 +48,49 @@ static const char *anims[NUM_ANIMATIONS] =
|
|||||||
"BeginnerHelper_step-jumplr.bones.txt"
|
"BeginnerHelper_step-jumplr.bones.txt"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static CString GetAnimPath(Animation a) {return CString("Characters/") + anims[a];}
|
||||||
static CString GetAnimPath( Animation a )
|
|
||||||
{
|
|
||||||
return CString("Characters/") + anims[a];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BeginnerHelper::BeginnerHelper()
|
BeginnerHelper::BeginnerHelper()
|
||||||
{
|
{
|
||||||
m_bFlashEnabled = false;
|
|
||||||
m_bShowBackground = true;
|
m_bShowBackground = true;
|
||||||
m_bInitialized = false;
|
m_bInitialized = false;
|
||||||
m_iLastRowChecked = 0;
|
m_iLastRowChecked = m_iLastRowFlashed = 0;
|
||||||
this->AddChild(&m_sBackground);
|
|
||||||
for(int pn=0; pn<NUM_PLAYERS; pn++)
|
for(int pn=0; pn<NUM_PLAYERS; pn++)
|
||||||
m_bPlayerEnabled[pn] = false;
|
m_bPlayerEnabled[pn] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BeginnerHelper::~BeginnerHelper()
|
BeginnerHelper::~BeginnerHelper() {}
|
||||||
{
|
|
||||||
LOG->Trace("BeginnerHelper::~BeginnerHelper()");
|
|
||||||
}
|
|
||||||
|
|
||||||
void BeginnerHelper::ShowStepCircle( int pn, int CSTEP )
|
void BeginnerHelper::ShowStepCircle( int pn, int CSTEP )
|
||||||
{
|
{
|
||||||
/*for( int ps=0; ps<NUM_PLAYERS; ps++ )
|
int isc=0; // Save OR issues within array boundries.. it's worth the extra few bytes of memory.
|
||||||
{
|
switch(CSTEP) {
|
||||||
m_sStepCircle[ps].SetXY( (HELPER_X + PLAYER_X(ps)), (HELPER_Y + 10) );
|
case ST_LEFT: isc=0; break;
|
||||||
switch( CSTEP )
|
case ST_RIGHT: isc=1; break;
|
||||||
{
|
case ST_UP: isc=2; break;
|
||||||
case ST_LEFT: m_sStepCircle[ps].SetRotationZ(270); break;
|
case ST_DOWN: isc=3; break;
|
||||||
case ST_DOWN: m_sStepCircle[ps].SetRotationZ(180); break;
|
|
||||||
case ST_UP: break;
|
|
||||||
case ST_RIGHT: m_sStepCircle[ps].SetRotationZ(90); break;
|
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sStepCircle[ps].SetZoom(1);
|
m_sStepCircle[pn][isc].SetEffectNone();
|
||||||
m_sStepCircle[ps].SetEffectNone();
|
m_sStepCircle[pn][isc].SetZoom(2);
|
||||||
m_sStepCircle[ps].StopTweening();
|
m_sStepCircle[pn][isc].StopTweening();
|
||||||
m_sStepCircle[ps].BeginTweening((GAMESTATE->m_fCurBPS/4), TWEEN_LINEAR);
|
m_sStepCircle[pn][isc].BeginTweening((GAMESTATE->m_fCurBPS/4), TWEEN_LINEAR);
|
||||||
m_sStepCircle[ps].SetZoom(0);
|
m_sStepCircle[pn][isc].SetZoom(0);
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void BeginnerHelper::SetFlash( CString sFilename, float fX, float fY )
|
|
||||||
{
|
|
||||||
m_sFlash.Load( sFilename );
|
|
||||||
m_sFlash.SetX(fX);
|
|
||||||
m_sFlash.SetY(fY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BeginnerHelper::AddPlayer( int pn, NoteData *pSteps )
|
void BeginnerHelper::AddPlayer( int pn, NoteData *pSteps )
|
||||||
{
|
{
|
||||||
ASSERT(!m_bInitialized);
|
ASSERT(!m_bInitialized);
|
||||||
ASSERT(pSteps != NULL);
|
ASSERT(pSteps != NULL);
|
||||||
ASSERT( pn >= 0 && pn < NUM_PLAYERS );
|
ASSERT((pn >= 0) && (pn < NUM_PLAYERS));
|
||||||
ASSERT(GAMESTATE->IsHumanPlayer(pn));
|
ASSERT(GAMESTATE->IsHumanPlayer(pn));
|
||||||
|
|
||||||
if( !CanUse() )
|
if(!CanUse()) {return;}
|
||||||
return;
|
|
||||||
const Character *Character = GAMESTATE->m_pCurCharacters[pn];
|
const Character *Character = GAMESTATE->m_pCurCharacters[pn];
|
||||||
ASSERT( Character != NULL );
|
ASSERT( Character != NULL );
|
||||||
if( !DoesFileExist( Character->GetModelPath() ) )
|
if(!DoesFileExist(Character->GetModelPath())) {return;}
|
||||||
return;
|
|
||||||
|
|
||||||
m_NoteData[pn].CopyAll(pSteps);
|
m_NoteData[pn].CopyAll(pSteps);
|
||||||
m_bPlayerEnabled[pn] = true;
|
m_bPlayerEnabled[pn] = true;
|
||||||
@@ -127,54 +99,56 @@ void BeginnerHelper::AddPlayer( int pn, NoteData *pSteps )
|
|||||||
bool BeginnerHelper::CanUse()
|
bool BeginnerHelper::CanUse()
|
||||||
{
|
{
|
||||||
for(int i=0; i<NUM_ANIMATIONS; ++i)
|
for(int i=0; i<NUM_ANIMATIONS; ++i)
|
||||||
if( !DoesFileExist( GetAnimPath( (Animation) i ) ) )
|
if(!DoesFileExist(GetAnimPath((Animation)i))) {return false;}
|
||||||
return false;
|
|
||||||
|
|
||||||
if( GAMESTATE->m_CurGame != GAME_DANCE )
|
if(GAMESTATE->m_CurGame != GAME_DANCE) {return false;}
|
||||||
return false;
|
|
||||||
|
|
||||||
switch( GAMESTATE->m_CurStyle )
|
switch( GAMESTATE->m_CurStyle ) {
|
||||||
{
|
|
||||||
case STYLE_DANCE_SOLO:
|
case STYLE_DANCE_SOLO:
|
||||||
case STYLE_DANCE_DOUBLE: return false;
|
case STYLE_DANCE_DOUBLE: return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BeginnerHelper::Initialize( int iDancePadType )
|
bool BeginnerHelper::Initialize( int iDancePadType )
|
||||||
{
|
{
|
||||||
ASSERT( !m_bInitialized );
|
ASSERT( !m_bInitialized );
|
||||||
|
if(!CanUse()) {return false;}
|
||||||
|
|
||||||
/* If no players were successfully added, bail. */
|
// If no players were successfully added, bail.
|
||||||
{
|
{
|
||||||
bool bAnyLoaded = false;
|
bool bAnyLoaded = false;
|
||||||
for(int pn=0; pn<NUM_PLAYERS; pn++)
|
for(int pn=0; pn<NUM_PLAYERS; pn++)
|
||||||
if( m_bPlayerEnabled[pn] )
|
if(m_bPlayerEnabled[pn]) {bAnyLoaded = true;}
|
||||||
bAnyLoaded = true;
|
if(!bAnyLoaded) {return false;}
|
||||||
if( !bAnyLoaded )
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !CanUse() ) // if we can't be used, bail now.
|
// Load the Background and flash.. Flash only shows if the BG does.
|
||||||
return false;
|
if(m_bShowBackground) {
|
||||||
|
|
||||||
// Load the StepCircle, Background, and flash animation
|
|
||||||
if( m_bShowBackground )
|
|
||||||
{
|
|
||||||
m_sBackground.Load( THEME->GetPathToG("BeginnerHelper background") );
|
m_sBackground.Load( THEME->GetPathToG("BeginnerHelper background") );
|
||||||
|
this->AddChild(&m_sBackground);
|
||||||
m_sBackground.SetXY(CENTER_X, CENTER_Y);
|
m_sBackground.SetXY(CENTER_X, CENTER_Y);
|
||||||
}
|
|
||||||
|
|
||||||
m_sFlash.Load(THEME->GetPathToG("BeginnerHelper flash"));
|
m_sFlash.Load(THEME->GetPathToG("BeginnerHelper flash"));
|
||||||
m_sFlash.SetXY(CENTER_X, CENTER_Y);
|
m_sFlash.SetXY(CENTER_X, CENTER_Y);
|
||||||
m_sFlash.SetDiffuseAlpha(0);
|
m_sFlash.SetDiffuseAlpha(0);
|
||||||
|
}
|
||||||
|
|
||||||
/*for( int sc=0; sc<NUM_PLAYERS*2; sc++ )
|
// Load StepCircle graphics
|
||||||
{
|
for(int lsc=0; lsc<NUM_PLAYERS; lsc++)
|
||||||
m_sStepCircle[sc].Load( THEME->GetPathToG("BeginnerHelper stepcircle") );
|
for(int lsce=0; lsce<4; lsce++) {
|
||||||
m_sStepCircle[sc].SetZoom(0); // Hide until needed.
|
m_sStepCircle[lsc][lsce].Load(THEME->GetPathToG("BeginnerHelper stepcircle"));
|
||||||
this->AddChild(&m_sStepCircle[sc]);
|
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
|
// Load the DancePad
|
||||||
switch(iDancePadType)
|
switch(iDancePadType)
|
||||||
@@ -183,6 +157,7 @@ bool BeginnerHelper::Initialize( int iDancePadType )
|
|||||||
case 1: m_mDancePad.LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break;
|
case 1: m_mDancePad.LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break;
|
||||||
case 2: m_mDancePad.LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break;
|
case 2: m_mDancePad.LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mDancePad.SetHorizAlign( align_left );
|
m_mDancePad.SetHorizAlign( align_left );
|
||||||
m_mDancePad.SetRotationX( DANCEPAD_ANGLE );
|
m_mDancePad.SetRotationX( DANCEPAD_ANGLE );
|
||||||
m_mDancePad.SetX(HELPER_X);
|
m_mDancePad.SetX(HELPER_X);
|
||||||
@@ -191,9 +166,10 @@ bool BeginnerHelper::Initialize( int iDancePadType )
|
|||||||
|
|
||||||
for( int pl=0; pl<NUM_PLAYERS; pl++ ) // Load players
|
for( int pl=0; pl<NUM_PLAYERS; pl++ ) // Load players
|
||||||
{
|
{
|
||||||
if( !m_bPlayerEnabled[pl] )
|
// Skip if not enabled
|
||||||
continue; // skip
|
if(!m_bPlayerEnabled[pl]) {continue;}
|
||||||
|
|
||||||
|
// Load character data
|
||||||
const Character *Character = GAMESTATE->m_pCurCharacters[pl];
|
const Character *Character = GAMESTATE->m_pCurCharacters[pl];
|
||||||
ASSERT( Character != NULL );
|
ASSERT( Character != NULL );
|
||||||
|
|
||||||
@@ -207,7 +183,6 @@ bool BeginnerHelper::Initialize( int iDancePadType )
|
|||||||
m_mDancer[pl].LoadMilkshapeAsciiBones("Step-UP", GetAnimPath(ANIM_UP));
|
m_mDancer[pl].LoadMilkshapeAsciiBones("Step-UP", GetAnimPath(ANIM_UP));
|
||||||
m_mDancer[pl].LoadMilkshapeAsciiBones("Step-RIGHT", GetAnimPath(ANIM_RIGHT));
|
m_mDancer[pl].LoadMilkshapeAsciiBones("Step-RIGHT", GetAnimPath(ANIM_RIGHT));
|
||||||
m_mDancer[pl].LoadMilkshapeAsciiBones("Step-JUMPLR", GetAnimPath(ANIM_JUMPLR));
|
m_mDancer[pl].LoadMilkshapeAsciiBones("Step-JUMPLR", GetAnimPath(ANIM_JUMPLR));
|
||||||
/*m_mDancer[pl].LoadMilkshapeAsciiBones( "Step-JUMPUD","Characters\\BeginnerHelper_step-jumpud.bones.txt" );*/
|
|
||||||
m_mDancer[pl].LoadMilkshapeAsciiBones("rest", Character->GetRestAnimationPath());
|
m_mDancer[pl].LoadMilkshapeAsciiBones("rest", Character->GetRestAnimationPath());
|
||||||
m_mDancer[pl].SetDefaultAnimation("rest");
|
m_mDancer[pl].SetDefaultAnimation("rest");
|
||||||
m_mDancer[pl].PlayAnimation("rest");
|
m_mDancer[pl].PlayAnimation("rest");
|
||||||
@@ -223,32 +198,17 @@ bool BeginnerHelper::Initialize( int iDancePadType )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BeginnerHelper::FlashOnce()
|
|
||||||
{
|
|
||||||
m_sFlash.SetDiffuseAlpha(1);
|
|
||||||
m_sFlash.SetEffectNone();
|
|
||||||
m_sFlash.StopTweening();
|
|
||||||
m_sFlash.BeginTweening( 1/GAMESTATE->m_fCurBPS * 0.5f );
|
|
||||||
m_sFlash.SetDiffuseAlpha(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BeginnerHelper::DrawPrimitives()
|
void BeginnerHelper::DrawPrimitives()
|
||||||
{
|
{
|
||||||
if(!m_bInitialized)
|
// If not initialized, don't bother with this
|
||||||
return;
|
if(!m_bInitialized) {return;}
|
||||||
|
|
||||||
ActorFrame::DrawPrimitives();
|
ActorFrame::DrawPrimitives();
|
||||||
|
|
||||||
m_sFlash.Draw();
|
m_sFlash.Draw();
|
||||||
|
|
||||||
bool DrawCelShaded = PREFSMAN->m_bCelShadeModels;
|
bool DrawCelShaded = PREFSMAN->m_bCelShadeModels;
|
||||||
|
if(DrawCelShaded) {m_mDancePad.DrawCelShaded();}
|
||||||
if(DrawCelShaded)
|
else {
|
||||||
{
|
|
||||||
m_mDancePad.DrawCelShaded();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DISPLAY->SetLighting( true );
|
DISPLAY->SetLighting( true );
|
||||||
DISPLAY->SetLightDirectional(
|
DISPLAY->SetLightDirectional(
|
||||||
0,
|
0,
|
||||||
@@ -258,22 +218,23 @@ void BeginnerHelper::DrawPrimitives()
|
|||||||
RageVector3(0, 0, 1) );
|
RageVector3(0, 0, 1) );
|
||||||
|
|
||||||
m_mDancePad.Draw();
|
m_mDancePad.Draw();
|
||||||
|
DISPLAY->ClearZBuffer(); // So character doesn't step "into" the dance pad.
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int scd=0; scd<NUM_PLAYERS*2; scd++ )
|
// Draw StepCircles
|
||||||
m_sStepCircle[scd].Draw(); // Should be drawn before the dancer, but after the pad, so it is drawn over the pad and under the dancer.
|
DISPLAY->SetLighting(false);
|
||||||
|
for(int scd=0; scd<NUM_PLAYERS; scd++)
|
||||||
|
for(int scde=0; scde<4; scde++)
|
||||||
|
m_sStepCircle[scd][scde].Draw();
|
||||||
|
DISPLAY->SetLighting(true);
|
||||||
|
|
||||||
if(DrawCelShaded)
|
if(DrawCelShaded) {
|
||||||
{
|
|
||||||
FOREACH_PlayerNumber(pn) // Draw each dancer
|
FOREACH_PlayerNumber(pn) // Draw each dancer
|
||||||
if( GAMESTATE->IsHumanPlayer(pn) )
|
if(GAMESTATE->IsHumanPlayer(pn)) {m_mDancer[pn].DrawCelShaded();}
|
||||||
m_mDancer[pn].DrawCelShaded();
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FOREACH_PlayerNumber(pn) // Draw each dancer
|
FOREACH_PlayerNumber(pn) // Draw each dancer
|
||||||
if( GAMESTATE->IsHumanPlayer(pn) )
|
if(GAMESTATE->IsHumanPlayer(pn)) {m_mDancer[pn].Draw();}
|
||||||
m_mDancer[pn].Draw();
|
|
||||||
|
|
||||||
DISPLAY->SetLightOff(0);
|
DISPLAY->SetLightOff(0);
|
||||||
DISPLAY->SetLighting(false);
|
DISPLAY->SetLighting(false);
|
||||||
@@ -282,76 +243,99 @@ void BeginnerHelper::DrawPrimitives()
|
|||||||
|
|
||||||
void BeginnerHelper::Step( int pn, int CSTEP )
|
void BeginnerHelper::Step( int pn, int CSTEP )
|
||||||
{
|
{
|
||||||
LOG->Trace( "BeginnerHelper::Step()" );
|
|
||||||
|
|
||||||
ShowStepCircle( pn, CSTEP);
|
|
||||||
m_mDancer[pn].StopTweening();
|
m_mDancer[pn].StopTweening();
|
||||||
m_mDancer[pn].SetRotationY(0); // Make sure we're not still inside of a JUMPUD tween.
|
m_mDancer[pn].SetRotationY(0); // Make sure we're not still inside of a JUMPUD tween.
|
||||||
switch( CSTEP )
|
|
||||||
{
|
|
||||||
case ST_LEFT: m_mDancer[pn].PlayAnimation( "Step-LEFT", 1.5f ); break;
|
|
||||||
case ST_RIGHT: m_mDancer[pn].PlayAnimation( "Step-RIGHT", 1.5f ); break;
|
|
||||||
case ST_UP: m_mDancer[pn].PlayAnimation( "Step-UP", 1.5f ); break;
|
|
||||||
case ST_DOWN: m_mDancer[pn].PlayAnimation( "Step-DOWN", 1.5f ); break;
|
|
||||||
case ST_JUMPLR: m_mDancer[pn].PlayAnimation( "Step-JUMPLR", 1.5f ); break;
|
|
||||||
case ST_JUMPUD:
|
|
||||||
// Until I can get an UP+DOWN jump animation, this will have to do.
|
|
||||||
m_mDancer[pn].PlayAnimation( "Step-JUMPLR", 1.5f );
|
|
||||||
|
|
||||||
|
switch(CSTEP) {
|
||||||
|
case ST_LEFT:
|
||||||
|
ShowStepCircle(pn, ST_LEFT);
|
||||||
|
m_mDancer[pn].PlayAnimation("Step-LEFT", 1.5f);
|
||||||
|
break;
|
||||||
|
case ST_RIGHT:
|
||||||
|
ShowStepCircle(pn, ST_RIGHT);
|
||||||
|
m_mDancer[pn].PlayAnimation("Step-RIGHT", 1.5f);
|
||||||
|
break;
|
||||||
|
case ST_UP:
|
||||||
|
ShowStepCircle(pn, ST_UP);
|
||||||
|
m_mDancer[pn].PlayAnimation("Step-UP", 1.5f);
|
||||||
|
break;
|
||||||
|
case ST_DOWN:
|
||||||
|
ShowStepCircle(pn, ST_DOWN);
|
||||||
|
m_mDancer[pn].PlayAnimation("Step-DOWN", 1.5f);
|
||||||
|
break;
|
||||||
|
case ST_JUMPLR:
|
||||||
|
ShowStepCircle(pn, ST_LEFT);
|
||||||
|
ShowStepCircle(pn, ST_RIGHT);
|
||||||
|
m_mDancer[pn].PlayAnimation("Step-JUMPLR", 1.5f);
|
||||||
|
break;
|
||||||
|
case ST_JUMPUD:
|
||||||
|
ShowStepCircle(pn, ST_UP);
|
||||||
|
ShowStepCircle(pn, ST_DOWN);
|
||||||
m_mDancer[pn].StopTweening();
|
m_mDancer[pn].StopTweening();
|
||||||
m_mDancer[pn].BeginTweening( GAMESTATE->m_fCurBPS /8, TWEEN_LINEAR );
|
m_mDancer[pn].PlayAnimation("Step-JUMPLR", 1.5f);
|
||||||
|
m_mDancer[pn].BeginTweening((GAMESTATE->m_fCurBPS /8), TWEEN_LINEAR);
|
||||||
m_mDancer[pn].SetRotationY(90);
|
m_mDancer[pn].SetRotationY(90);
|
||||||
m_mDancer[pn].BeginTweening((1/(GAMESTATE->m_fCurBPS * 2))); //sleep between jump-frames
|
m_mDancer[pn].BeginTweening((1/(GAMESTATE->m_fCurBPS * 2))); //sleep between jump-frames
|
||||||
m_mDancer[pn].BeginTweening(GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR);
|
m_mDancer[pn].BeginTweening(GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR);
|
||||||
m_mDancer[pn].SetRotationY(0);
|
m_mDancer[pn].SetRotationY(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_sFlash.SetEffectNone();
|
||||||
|
m_sFlash.StopTweening();
|
||||||
|
m_sFlash.Sleep(GAMESTATE->m_fCurBPS /16);
|
||||||
|
m_sFlash.SetDiffuseAlpha(1);
|
||||||
|
m_sFlash.BeginTweening(1/GAMESTATE->m_fCurBPS * 0.5f);
|
||||||
|
m_sFlash.SetDiffuseAlpha(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BeginnerHelper::Update( float fDeltaTime )
|
void BeginnerHelper::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
if(!m_bInitialized)
|
if(!m_bInitialized) {return;}
|
||||||
return;
|
|
||||||
|
|
||||||
// the row we want to check on this update
|
// the row we want to check on this update
|
||||||
int iCurRow = BeatToNoteRowNotRounded(GAMESTATE->m_fSongBeat + 0.4f);
|
int iCurRow = BeatToNoteRowNotRounded(GAMESTATE->m_fSongBeat + 0.4f);
|
||||||
|
int iActualRow = BeatToNoteRowNotRounded(GAMESTATE->m_fSongBeat);
|
||||||
for(int pn=0; pn<NUM_PLAYERS; pn++)
|
for(int pn=0; pn<NUM_PLAYERS; pn++)
|
||||||
{
|
{
|
||||||
if( !m_bPlayerEnabled[pn] )
|
// Skip if not enabled
|
||||||
continue; // skip
|
if(!m_bPlayerEnabled[pn]) {continue;}
|
||||||
|
|
||||||
if( (m_NoteData[pn].IsThereATapAtRow( BeatToNoteRowNotRounded((GAMESTATE->m_fSongBeat+0.01f)) ) ) )
|
|
||||||
FlashOnce();
|
|
||||||
for(int iRow=m_iLastRowChecked; iRow<iCurRow; iRow++)
|
for(int iRow=m_iLastRowChecked; iRow<iCurRow; iRow++)
|
||||||
{
|
{
|
||||||
if( !m_NoteData[pn].IsThereATapAtRow( iRow ) )
|
// Check if there are any notes at all on this row.. If not, save scanning.
|
||||||
continue;
|
if(!m_NoteData[pn].IsThereATapAtRow(iRow)) {continue;}
|
||||||
|
|
||||||
|
// Find all steps on this row, in order to show the correct animations
|
||||||
int iStep = 0;
|
int iStep = 0;
|
||||||
const int iNumTracks = m_NoteData[pn].GetNumTracks();
|
const int iNumTracks = m_NoteData[pn].GetNumTracks();
|
||||||
for(int k=0; k<iNumTracks; k++)
|
for(int k=0; k<iNumTracks; k++)
|
||||||
if( m_NoteData[pn].GetTapNote(k, iRow ) == TAP_TAP )
|
if(m_NoteData[pn].GetTapNote(k, iRow) == TAP_TAP) {iStep |= 1 << k;}
|
||||||
iStep |= 1 << k;
|
|
||||||
Step( pn, iStep );
|
// Assign new data
|
||||||
|
this->Step(pn, iStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure we don't accidentally scan a row 2x
|
||||||
m_iLastRowChecked = iCurRow;
|
m_iLastRowChecked = iCurRow;
|
||||||
|
|
||||||
|
// Update animations
|
||||||
ActorFrame::Update(fDeltaTime);
|
ActorFrame::Update(fDeltaTime);
|
||||||
m_mDancePad.Update(fDeltaTime);
|
m_mDancePad.Update(fDeltaTime);
|
||||||
m_sFlash.Update(fDeltaTime);
|
m_sFlash.Update(fDeltaTime);
|
||||||
|
|
||||||
float beat = fDeltaTime * GAMESTATE->m_fCurBPS;
|
float beat = (fDeltaTime*GAMESTATE->m_fCurBPS);
|
||||||
|
|
||||||
for(int pu=0; pu<NUM_PLAYERS; pu++)
|
for(int pu=0; pu<NUM_PLAYERS; pu++)
|
||||||
{
|
{
|
||||||
if(!GAMESTATE->IsHumanPlayer(pu))
|
// If this is not a human player, the dancer is not shown
|
||||||
continue;
|
if(!GAMESTATE->IsHumanPlayer(pu)) {continue;}
|
||||||
|
|
||||||
m_mDancer[pu].Update( beat ); //Update dancers
|
// Update dancer's animation and StepCircles
|
||||||
for( int scu=0; scu<2; scu++ )
|
m_mDancer[pu].Update( beat );
|
||||||
m_sStepCircle[pu+scu].Update( beat );
|
for(int scu=0; scu<NUM_PLAYERS; scu++)
|
||||||
|
for(int scue=0; scue<4; scue++)
|
||||||
|
m_sStepCircle[scu][scue].Update(beat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,16 +14,11 @@ public:
|
|||||||
BeginnerHelper();
|
BeginnerHelper();
|
||||||
~BeginnerHelper();
|
~BeginnerHelper();
|
||||||
|
|
||||||
void FlashOnce();
|
|
||||||
bool Initialize( int iDancePadType );
|
bool Initialize( int iDancePadType );
|
||||||
bool IsInitialized() { return m_bInitialized; }
|
bool IsInitialized() { return m_bInitialized; }
|
||||||
static bool CanUse();
|
static bool CanUse();
|
||||||
void AddPlayer( int pn, NoteData *pSteps );
|
void AddPlayer( int pn, NoteData *pSteps );
|
||||||
void SetFlash(CString sFilename, float fX, float fY);
|
|
||||||
void ShowStepCircle( int pn, int CSTEP );
|
void ShowStepCircle( int pn, int CSTEP );
|
||||||
void TurnFlashOff();
|
|
||||||
void TurnFlashOn();
|
|
||||||
|
|
||||||
bool m_bShowBackground;
|
bool m_bShowBackground;
|
||||||
|
|
||||||
void Update( float fDeltaTime );
|
void Update( float fDeltaTime );
|
||||||
@@ -38,11 +33,11 @@ protected:
|
|||||||
Model m_mDancePad;
|
Model m_mDancePad;
|
||||||
Sprite m_sFlash;
|
Sprite m_sFlash;
|
||||||
Sprite m_sBackground;
|
Sprite m_sBackground;
|
||||||
Sprite m_sStepCircle[NUM_PLAYERS*2]; // Need two for each player during jumps
|
Sprite m_sStepCircle[NUM_PLAYERS][4]; // More memory, but much easier to manage
|
||||||
|
|
||||||
int m_iLastRowChecked;
|
int m_iLastRowChecked;
|
||||||
|
int m_iLastRowFlashed;
|
||||||
bool m_bInitialized;
|
bool m_bInitialized;
|
||||||
bool m_bFlashEnabled;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user