Added How To Play screen, improved scroll bar, and added "toasty" easter egg.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
------------------------CVS after 3.00 beta 6----------------
|
||||
CHANGE: NG no longer breaks combo.
|
||||
NEW FEATURE: Hidden easter egg. You have to be "perfect" to find it.
|
||||
And cheaters never prosper!
|
||||
NEW FEATURE: If a song is missing Notes of a certain NotesType, Notes of
|
||||
the missing type will be generated from the existing types. For
|
||||
example, this will allow any pump song to be played in the dance
|
||||
|
||||
@@ -296,12 +296,13 @@ GradeP2Y=118
|
||||
|
||||
[MusicWheel]
|
||||
FadeSeconds=1
|
||||
SwitchSeconds=0.1
|
||||
SwitchSeconds=0.10
|
||||
SampleMusicDelay=0.2
|
||||
RouletteSwitchSeconds=0.05
|
||||
RouletteSlowDownSwitches=5
|
||||
LockedInitialVelocity=7
|
||||
ScrollBarX=150
|
||||
ScrollBarX=148
|
||||
ScrollBarHeight=360
|
||||
SectionColor1=0.9, 0.0, 0.2, 1
|
||||
SectionColor2=0.6, 0.0, 0.4, 1
|
||||
SectionColor3=0.2, 0.1, 0.3, 1
|
||||
|
||||
+71
-44
@@ -14,12 +14,14 @@
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "ScreenGameplay.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
Combo::Combo()
|
||||
{
|
||||
m_iCurCombo = 0;
|
||||
m_iMaxCombo = 0;
|
||||
m_iCurComboOfPerfects = 0;
|
||||
|
||||
m_sprCombo.Load( THEME->GetPathTo("Graphics", "gameplay combo") );
|
||||
m_sprCombo.TurnShadowOn();
|
||||
@@ -41,61 +43,86 @@ Combo::Combo()
|
||||
}
|
||||
|
||||
|
||||
void Combo::ContinueCombo()
|
||||
void Combo::UpdateScore( TapNoteScore score )
|
||||
{
|
||||
m_iCurCombo++;
|
||||
if( PREFSMAN->m_bAutoPlay ) // cheaters never prosper
|
||||
{
|
||||
m_iCurCombo = 0;
|
||||
m_iCurComboOfPerfects = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If needed, make this a theme metric. */
|
||||
const bool HighComboAlert_OnceOnly = true;
|
||||
|
||||
if(!HighComboAlert_OnceOnly || m_iCurCombo > m_iMaxCombo)
|
||||
switch( m_iCurCombo )
|
||||
switch( score )
|
||||
{
|
||||
case 100: SCREENMAN->SendMessageToTopScreen( SM_100Combo, 0 ); break;
|
||||
case 200: SCREENMAN->SendMessageToTopScreen( SM_200Combo, 0 ); break;
|
||||
case 300: SCREENMAN->SendMessageToTopScreen( SM_300Combo, 0 ); break;
|
||||
case 400: SCREENMAN->SendMessageToTopScreen( SM_400Combo, 0 ); break;
|
||||
case 500: SCREENMAN->SendMessageToTopScreen( SM_500Combo, 0 ); break;
|
||||
case 600: SCREENMAN->SendMessageToTopScreen( SM_600Combo, 0 ); break;
|
||||
case 700: SCREENMAN->SendMessageToTopScreen( SM_700Combo, 0 ); break;
|
||||
case 800: SCREENMAN->SendMessageToTopScreen( SM_800Combo, 0 ); break;
|
||||
case 900: SCREENMAN->SendMessageToTopScreen( SM_900Combo, 0 ); break;
|
||||
case 1000: SCREENMAN->SendMessageToTopScreen( SM_1000Combo, 0 ); break;
|
||||
}
|
||||
case TNS_PERFECT:
|
||||
case TNS_GREAT:
|
||||
|
||||
// new max combo
|
||||
m_iMaxCombo = max(m_iMaxCombo, m_iCurCombo);
|
||||
// continue combo
|
||||
m_iCurCombo++;
|
||||
|
||||
if( score == TNS_PERFECT ) m_iCurComboOfPerfects++;
|
||||
else m_iCurComboOfPerfects = 0;
|
||||
|
||||
if( (m_iCurComboOfPerfects%150)==0 && RandomFloat(0,1) > 0.5 && !GAMESTATE->m_bDemonstration )
|
||||
SCREENMAN->SendMessageToTopScreen( SM_BeginToasty, 0 );
|
||||
|
||||
|
||||
if(!HighComboAlert_OnceOnly || m_iCurCombo > m_iMaxCombo)
|
||||
switch( m_iCurCombo )
|
||||
{
|
||||
case 100: SCREENMAN->SendMessageToTopScreen( SM_100Combo, 0 ); break;
|
||||
case 200: SCREENMAN->SendMessageToTopScreen( SM_200Combo, 0 ); break;
|
||||
case 300: SCREENMAN->SendMessageToTopScreen( SM_300Combo, 0 ); break;
|
||||
case 400: SCREENMAN->SendMessageToTopScreen( SM_400Combo, 0 ); break;
|
||||
case 500: SCREENMAN->SendMessageToTopScreen( SM_500Combo, 0 ); break;
|
||||
case 600: SCREENMAN->SendMessageToTopScreen( SM_600Combo, 0 ); break;
|
||||
case 700: SCREENMAN->SendMessageToTopScreen( SM_700Combo, 0 ); break;
|
||||
case 800: SCREENMAN->SendMessageToTopScreen( SM_800Combo, 0 ); break;
|
||||
case 900: SCREENMAN->SendMessageToTopScreen( SM_900Combo, 0 ); break;
|
||||
case 1000: SCREENMAN->SendMessageToTopScreen( SM_1000Combo, 0 ); break;
|
||||
}
|
||||
|
||||
// new max combo
|
||||
m_iMaxCombo = max(m_iMaxCombo, m_iCurCombo);
|
||||
|
||||
|
||||
if( m_iCurCombo <= 4 )
|
||||
{
|
||||
m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
||||
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
||||
|
||||
m_textComboNumber.SetText( ssprintf("%d", m_iCurCombo) );
|
||||
float fNewZoom = min( 0.5f + m_iCurCombo/800.0f, 1.0f );
|
||||
m_textComboNumber.SetZoom( fNewZoom );
|
||||
|
||||
//this->SetZoom( 1.2f );
|
||||
//this->BeginTweening( 0.3f );
|
||||
//this->SetTweenZoom( 1 );
|
||||
}
|
||||
break;
|
||||
case TNS_GOOD:
|
||||
case TNS_BOO:
|
||||
case TNS_MISS:
|
||||
// end combo
|
||||
if( m_iCurCombo > 50 )
|
||||
SCREENMAN->SendMessageToTopScreen( SM_ComboStopped, 0 );
|
||||
|
||||
m_iCurCombo = 0;
|
||||
|
||||
if( m_iCurCombo <= 4 )
|
||||
{
|
||||
m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
||||
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // visible
|
||||
|
||||
m_textComboNumber.SetText( ssprintf("%d", m_iCurCombo) );
|
||||
float fNewZoom = min( 0.5f + m_iCurCombo/800.0f, 1.0f );
|
||||
m_textComboNumber.SetZoom( fNewZoom );
|
||||
|
||||
//this->SetZoom( 1.2f );
|
||||
//this->BeginTweening( 0.3f );
|
||||
//this->SetTweenZoom( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
void Combo::EndCombo()
|
||||
{
|
||||
if( m_iCurCombo > 50 )
|
||||
SCREENMAN->SendMessageToTopScreen( SM_ComboStopped, 0 );
|
||||
|
||||
m_iCurCombo = 0;
|
||||
|
||||
m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||
|
||||
}
|
||||
|
||||
int Combo::GetCurrentCombo()
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "ActorFrame.h"
|
||||
#include "Sprite.h"
|
||||
#include "BitmapText.h"
|
||||
#include "GameConstantsAndTypes.h" // for TapNoteScore
|
||||
|
||||
|
||||
|
||||
@@ -21,8 +22,7 @@ class Combo : public ActorFrame
|
||||
public:
|
||||
Combo();
|
||||
|
||||
void ContinueCombo();
|
||||
void EndCombo();
|
||||
void UpdateScore( TapNoteScore score );
|
||||
|
||||
int GetCurrentCombo();
|
||||
int GetMaxCombo();
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
protected:
|
||||
int m_iCurCombo;
|
||||
int m_iMaxCombo;
|
||||
int m_iCurComboOfPerfects;
|
||||
|
||||
bool m_bComboVisible;
|
||||
Sprite m_sprCombo;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#define ROULETTE_SLOW_DOWN_SWITCHES THEME->GetMetricI("MusicWheel","RouletteSlowDownSwitches")
|
||||
#define LOCKED_INITIAL_VELOCITY THEME->GetMetricF("MusicWheel","LockedInitialVelocity")
|
||||
#define SCROLL_BAR_X THEME->GetMetricF("MusicWheel","ScrollBarX")
|
||||
#define SCROLL_BAR_HEIGHT THEME->GetMetricI("MusicWheel","ScrollBarHeight")
|
||||
#define SECTION_COLOR_1 THEME->GetMetricC("MusicWheel","SectionColor1")
|
||||
#define SECTION_COLOR_2 THEME->GetMetricC("MusicWheel","SectionColor2")
|
||||
#define SECTION_COLOR_3 THEME->GetMetricC("MusicWheel","SectionColor3")
|
||||
@@ -301,6 +302,7 @@ MusicWheel::MusicWheel()
|
||||
AddSubActor( &m_sprSelectionOverlay );
|
||||
|
||||
m_ScrollBar.SetX( SCROLL_BAR_X );
|
||||
m_ScrollBar.SetBarHeight( SCROLL_BAR_HEIGHT );
|
||||
this->AddSubActor( &m_ScrollBar );
|
||||
|
||||
m_soundChangeMusic.Load( THEME->GetPathTo("Sounds","select music change music"), 16 );
|
||||
@@ -750,7 +752,8 @@ void MusicWheel::Update( float fDeltaTime )
|
||||
}
|
||||
|
||||
float fScrollPercentage = (m_iSelection-m_fPositionOffsetFromSelection) / (float)GetCurWheelItemDatas().GetSize();
|
||||
m_ScrollBar.SetPercentage( fScrollPercentage );
|
||||
float fPercentItemsShowing = NUM_WHEEL_ITEMS_TO_DRAW / (float)GetCurWheelItemDatas().GetSize();
|
||||
m_ScrollBar.SetPercentage( fScrollPercentage-fPercentItemsShowing/2, fScrollPercentage+fPercentItemsShowing/2 );
|
||||
|
||||
if( m_WheelState == STATE_ROULETTE_SPINNING )
|
||||
{
|
||||
@@ -922,7 +925,7 @@ void MusicWheel::Update( float fDeltaTime )
|
||||
if( m_WheelState == STATE_ROULETTE_SPINNING )
|
||||
fSpinSpeed = 1.0f/ROULETTE_SWITCH_SECONDS;
|
||||
else
|
||||
fSpinSpeed = 0.6f + fabsf(m_fPositionOffsetFromSelection)/SWITCH_SECONDS;
|
||||
fSpinSpeed = 0.2f + fabsf(m_fPositionOffsetFromSelection)/SWITCH_SECONDS;
|
||||
|
||||
if( m_fPositionOffsetFromSelection > 0 )
|
||||
{
|
||||
|
||||
@@ -531,7 +531,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
||||
for( fY=max(fYTailTop,fYHead); fY<fYTailBottom; fY+=fYStep ) // don't draw the part of the tail that is before the middle of the head
|
||||
{
|
||||
const float fYTop = fY;
|
||||
const float fYBottom = fY+fYStep;
|
||||
const float fYBottom = fY+min(fYStep, fYTailBottom-fY);
|
||||
const float fXTop = ArrowGetXPos2( m_PlayerNumber, iCol, fYTop );
|
||||
const float fXBottom = ArrowGetXPos2( m_PlayerNumber, iCol, fYBottom );
|
||||
const float fXTopLeft = fXTop - fFrameWidth/2;
|
||||
@@ -542,6 +542,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
||||
const float fBottomDistFromTailTop = fYBottom - fYTailTop;
|
||||
const float fTexCoordTop = SCALE( fTopDistFromTailTop, 0, fFrameHeight, 0.5f, 1.0f );
|
||||
const float fTexCoordBottom = SCALE( fBottomDistFromTailTop, 0, fFrameHeight, 0.5f, 1.0f );
|
||||
ASSERT( fBottomDistFromTailTop <= fFrameHeight );
|
||||
const float fTexCoordLeft = bActive ? 0.25f : 0.00f;
|
||||
const float fTexCoordRight = bActive ? 0.50f : 0.25f;
|
||||
const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, fYTop );
|
||||
|
||||
@@ -200,7 +200,6 @@ void Player::Update( float fDeltaTime )
|
||||
{
|
||||
hns = HNS_NG;
|
||||
HandleNoteScore( hns );
|
||||
m_Combo.EndCombo();
|
||||
m_HoldJudgement[hn.m_iTrack].SetHoldJudgement( HNS_NG );
|
||||
m_NoteField.m_HoldNoteScores[i] = HNS_NG; // update the NoteField display
|
||||
}
|
||||
@@ -401,18 +400,8 @@ void Player::OnRowDestroyed( int col, int iIndexThatWasSteppedOn )
|
||||
HandleNoteScore( score ); // update score - called once per note in this row
|
||||
|
||||
// update combo - called once per note in this row
|
||||
switch( score )
|
||||
{
|
||||
case TNS_PERFECT:
|
||||
case TNS_GREAT:
|
||||
m_Combo.ContinueCombo();
|
||||
GAMESTATE->m_iMaxCombo[m_PlayerNumber] = max( GAMESTATE->m_iMaxCombo[m_PlayerNumber], m_Combo.GetCurrentCombo() );
|
||||
break;
|
||||
case TNS_GOOD:
|
||||
case TNS_BOO:
|
||||
m_Combo.EndCombo();
|
||||
break;
|
||||
}
|
||||
m_Combo.UpdateScore( score );
|
||||
GAMESTATE->m_iMaxCombo[m_PlayerNumber] = max( GAMESTATE->m_iMaxCombo[m_PlayerNumber], m_Combo.GetCurrentCombo() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +457,7 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat )
|
||||
if( iNumMissesFound > 0 )
|
||||
{
|
||||
m_Judgement.SetJudgement( TNS_MISS );
|
||||
m_Combo.EndCombo();
|
||||
m_Combo.UpdateScore( TNS_MISS );
|
||||
}
|
||||
|
||||
return iNumMissesFound;
|
||||
|
||||
@@ -179,7 +179,7 @@ float PLAYER_OPTIONS_Y( int p, bool bExtra ) {
|
||||
const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+101);
|
||||
const ScreenMessage SM_BeginLoadingNextSong = ScreenMessage(SM_User+102);
|
||||
const ScreenMessage SM_BeginFadingToTitleMenu = ScreenMessage(SM_User+103);
|
||||
|
||||
const ScreenMessage SM_PlayToastySound = ScreenMessage(SM_User+105);
|
||||
|
||||
// received while STATE_OUTRO
|
||||
const ScreenMessage SM_ShowCleared = ScreenMessage(SM_User+111);
|
||||
@@ -535,6 +535,12 @@ ScreenGameplay::ScreenGameplay()
|
||||
this->AddSubActor( &m_textSurviveTime );
|
||||
|
||||
|
||||
m_sprToasty.Load( THEME->GetPathTo("Graphics","gameplay toasty") );
|
||||
m_sprToasty.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
this->AddSubActor( &m_sprToasty );
|
||||
|
||||
m_soundToasty.Load( THEME->GetPathTo("Sounds","gameplay toasty") );
|
||||
|
||||
|
||||
if( !GAMESTATE->m_bDemonstration ) // don't load sounds if just playing demonstration
|
||||
{
|
||||
@@ -903,7 +909,7 @@ void ScreenGameplay::Update( float fDeltaTime )
|
||||
}
|
||||
|
||||
if( bAnyoneHasANote )
|
||||
m_soundAssistTick.PlayRandom();
|
||||
m_soundAssistTick.Play();
|
||||
|
||||
|
||||
iRowLastCrossed = iRowNow;
|
||||
@@ -945,7 +951,6 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
|
||||
SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","insert coin") );
|
||||
::Sleep( 1000 ); // do a little pause, like the arcade does
|
||||
this->SendScreenMessage( SM_GoToTitleMenu, 0 );
|
||||
// m_Fade.CloseWipingRight( SM_GoToTitleMenu );
|
||||
}
|
||||
return; // don't fall through below
|
||||
}
|
||||
@@ -955,6 +960,9 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
|
||||
{
|
||||
switch( DeviceI.button )
|
||||
{
|
||||
// case DIK_F6:
|
||||
// this->SendScreenMessage( SM_BeginToasty, 0 );
|
||||
// break;
|
||||
case DIK_F7:
|
||||
if( GAMESTATE->m_SongOptions.m_AssistType == SongOptions::ASSIST_NONE )
|
||||
GAMESTATE->m_SongOptions.m_AssistType = SongOptions::ASSIST_TICK;
|
||||
@@ -1251,6 +1259,26 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
m_Fade.CloseWipingRight( SM_GoToTitleMenu );
|
||||
break;
|
||||
|
||||
case SM_BeginToasty:
|
||||
this->SendScreenMessage( SM_PlayToastySound, 0.3f );
|
||||
|
||||
// set off screen
|
||||
m_sprToasty.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
m_sprToasty.SetX( SCREEN_RIGHT+m_sprToasty.GetUnzoomedWidth()/2 );
|
||||
m_sprToasty.SetY( SCREEN_BOTTOM-m_sprToasty.GetUnzoomedHeight()/2 );
|
||||
m_sprToasty.BeginTweeningQueued( 0.2f, Actor::TWEEN_BIAS_BEGIN ); // slide on
|
||||
m_sprToasty.SetTweenX( SCREEN_RIGHT-m_sprToasty.GetUnzoomedWidth()/2 );
|
||||
m_sprToasty.BeginTweeningQueued( 0.6f ); // sleep
|
||||
m_sprToasty.BeginTweeningQueued( 0.3f, Actor::TWEEN_BIAS_END ); // slide off
|
||||
m_sprToasty.SetTweenX( SCREEN_RIGHT+m_sprToasty.GetUnzoomedWidth()/2 );
|
||||
m_sprToasty.BeginTweeningQueued( 0.001f ); // fade out
|
||||
m_sprToasty.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
break;
|
||||
|
||||
case SM_PlayToastySound:
|
||||
m_soundToasty.Play();
|
||||
break;
|
||||
|
||||
case SM_100Combo:
|
||||
if( m_fTimeLeftBeforeDancingComment < 12 )
|
||||
{
|
||||
@@ -1332,11 +1360,13 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
|
||||
// received while STATE_OUTRO
|
||||
case SM_ShowCleared:
|
||||
m_sprCleared.StartFocusing();
|
||||
m_sprCleared.BeginTweening(1.0f);
|
||||
m_sprCleared.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
SCREENMAN->SendMessageToTopScreen( SM_HideCleared, 2.5 );
|
||||
break;
|
||||
case SM_HideCleared:
|
||||
m_sprCleared.StartBlurring();
|
||||
m_sprCleared.BeginTweening(1.0f);
|
||||
m_sprCleared.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
SCREENMAN->SendMessageToTopScreen( SM_GoToStateAfterCleared, 1 );
|
||||
break;
|
||||
case SM_SaveChangedBeforeGoingBack:
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
|
||||
// messages sent by Combo
|
||||
const ScreenMessage SM_BeginToasty = ScreenMessage(SM_User+104);
|
||||
|
||||
const ScreenMessage SM_100Combo = ScreenMessage(SM_User+200);
|
||||
const ScreenMessage SM_200Combo = ScreenMessage(SM_User+201);
|
||||
const ScreenMessage SM_300Combo = ScreenMessage(SM_User+202);
|
||||
@@ -102,7 +104,7 @@ private:
|
||||
|
||||
FocusingSprite m_sprReady;
|
||||
FocusingSprite m_sprHereWeGo;
|
||||
FocusingSprite m_sprCleared;
|
||||
MotionBlurSprite m_sprCleared;
|
||||
MotionBlurSprite m_sprFailed;
|
||||
|
||||
BitmapText m_textSurviveTime; // only shown in extra stage
|
||||
@@ -115,6 +117,8 @@ private:
|
||||
Sprite m_sprOniGameOver[NUM_PLAYERS];
|
||||
void ShowOniGameOver( PlayerNumber p );
|
||||
|
||||
Sprite m_sprToasty; // easter egg
|
||||
|
||||
Quad m_quadDemonstrationBox;
|
||||
Sprite m_sprDemonstration;
|
||||
|
||||
@@ -138,11 +142,13 @@ private:
|
||||
RandomSample m_announcerComboStopped;
|
||||
|
||||
|
||||
|
||||
int m_iRowLastCrossed;
|
||||
RandomSample m_soundAssistTick;
|
||||
RageSoundSample m_soundAssistTick;
|
||||
|
||||
RageSoundStream m_soundMusic;
|
||||
RageSoundSample m_soundToasty;
|
||||
|
||||
|
||||
RageSoundStream m_soundMusic;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScreenHowToPlay
|
||||
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ScreenHowToPlay.h"
|
||||
#include <assert.h>
|
||||
#include "RageTextureManager.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageMusic.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "ScreenSelectMusic.h"
|
||||
#include "ScreenSelectCourse.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User + 1);
|
||||
|
||||
|
||||
ScreenHowToPlay::ScreenHowToPlay()
|
||||
{
|
||||
LOG->Trace( "ScreenHowToPlay::ScreenHowToPlay()" );
|
||||
|
||||
m_Menu.Load(
|
||||
THEME->GetPathTo("Graphics","How To Play Background"),
|
||||
THEME->GetPathTo("Graphics","How To Play Top Edge"),
|
||||
ssprintf("%s %s to change line %s %s to select between options then press START", CString(char(3)), CString(char(4)), CString(char(1)), CString(char(2)) ),
|
||||
false, true, 20
|
||||
);
|
||||
this->AddSubActor( &m_Menu );
|
||||
|
||||
CString sHowToPlayPath;
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_ARCADE:
|
||||
case PLAY_MODE_ENDLESS:
|
||||
sHowToPlayPath = THEME->GetPathTo("Graphics","How To Play Arcade");
|
||||
break;
|
||||
case PLAY_MODE_ONI:
|
||||
sHowToPlayPath = THEME->GetPathTo("Graphics","How To Play Arcade");
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
m_sprHowToPlay.Load( sHowToPlayPath );
|
||||
m_sprHowToPlay.SetXY( CENTER_X, CENTER_Y );
|
||||
this->AddSubActor( &m_sprHowToPlay );
|
||||
|
||||
m_sprHowToPlay.SetX( SCREEN_LEFT-SCREEN_WIDTH );
|
||||
m_sprHowToPlay.BeginTweening( 0.3f, Actor::TWEEN_BIAS_BEGIN );
|
||||
m_sprHowToPlay.SetTweenX( 0 );
|
||||
}
|
||||
|
||||
ScreenHowToPlay::~ScreenHowToPlay()
|
||||
{
|
||||
LOG->Trace( "ScreenHowToPlay::~ScreenHowToPlay()" );
|
||||
|
||||
}
|
||||
|
||||
void ScreenHowToPlay::Update( float fDeltaTime )
|
||||
{
|
||||
//LOG->Trace( "ScreenHowToPlay::Update(%f)", fDeltaTime );
|
||||
|
||||
Screen::Update( fDeltaTime );
|
||||
}
|
||||
|
||||
void ScreenHowToPlay::DrawPrimitives()
|
||||
{
|
||||
m_Menu.DrawBottomLayer();
|
||||
Screen::DrawPrimitives();
|
||||
m_Menu.DrawTopLayer();
|
||||
}
|
||||
|
||||
void ScreenHowToPlay::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||
{
|
||||
if( m_Menu.IsClosing() )
|
||||
return;
|
||||
|
||||
// default input handler
|
||||
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||
}
|
||||
|
||||
void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
switch( SM )
|
||||
{
|
||||
case SM_MenuTimer:
|
||||
this->MenuStart(PLAYER_1);
|
||||
break;
|
||||
case SM_GoToNextState:
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_ARCADE:
|
||||
SCREENMAN->SetNewScreen( new ScreenSelectMusic );
|
||||
break;
|
||||
case PLAY_MODE_ONI:
|
||||
case PLAY_MODE_ENDLESS:
|
||||
SCREENMAN->SetNewScreen( new ScreenSelectCourse );
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenHowToPlay::MenuBack( const PlayerNumber p )
|
||||
{
|
||||
}
|
||||
|
||||
void ScreenHowToPlay::MenuStart( const PlayerNumber p )
|
||||
{
|
||||
m_Menu.TweenOffScreenToMenu( SM_GoToNextState );
|
||||
|
||||
m_sprHowToPlay.BeginTweening( 0.3f, Actor::TWEEN_BIAS_END );
|
||||
m_sprHowToPlay.SetTweenX( SCREEN_RIGHT );
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScreenHowToPlay
|
||||
|
||||
Desc: A grid of options, and the selected option is drawn with a highlight rectangle.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "Screen.h"
|
||||
#include "Sprite.h"
|
||||
#include "RandomSample.h"
|
||||
#include "TransitionInvisible.h"
|
||||
#include "MenuElements.h"
|
||||
|
||||
|
||||
class ScreenHowToPlay : public Screen
|
||||
{
|
||||
public:
|
||||
ScreenHowToPlay();
|
||||
virtual ~ScreenHowToPlay();
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void DrawPrimitives();
|
||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
|
||||
virtual void MenuBack( const PlayerNumber p );
|
||||
virtual void MenuStart( const PlayerNumber p );
|
||||
|
||||
protected:
|
||||
Sprite m_sprHowToPlay;
|
||||
MenuElements m_Menu;
|
||||
};
|
||||
|
||||
+69
-18
@@ -15,39 +15,90 @@
|
||||
#include "GameConstantsAndTypes.h"
|
||||
|
||||
|
||||
const float BAR_HEIGHT = 376;
|
||||
|
||||
ScrollBar::ScrollBar()
|
||||
{
|
||||
m_sprBackground.Load( THEME->GetPathTo("Graphics","select music scrollbar") );
|
||||
m_sprBackground.Load( THEME->GetPathTo("Graphics","select music scrollbar 2x2") );
|
||||
m_sprBackground.StopAnimating();
|
||||
m_sprBackground.SetState( 1 );
|
||||
m_sprBackground.SetZoomY( BAR_HEIGHT/m_sprBackground.GetUnzoomedHeight() );
|
||||
this->AddSubActor( &m_sprBackground );
|
||||
|
||||
m_sprTopButton.Load( THEME->GetPathTo("Graphics","select music scrollbar") );
|
||||
m_sprScrollThumbPart1.Load( THEME->GetPathTo("Graphics","select music scrollbar 2x2") );
|
||||
m_sprScrollThumbPart1.StopAnimating();
|
||||
m_sprScrollThumbPart1.SetState( 3 );
|
||||
this->AddSubActor( &m_sprScrollThumbPart1 );
|
||||
|
||||
m_sprScrollThumbPart2.Load( THEME->GetPathTo("Graphics","select music scrollbar 2x2") );
|
||||
m_sprScrollThumbPart2.StopAnimating();
|
||||
m_sprScrollThumbPart2.SetState( 3 );
|
||||
this->AddSubActor( &m_sprScrollThumbPart2 );
|
||||
|
||||
m_sprTopButton.Load( THEME->GetPathTo("Graphics","select music scrollbar 2x2") );
|
||||
m_sprTopButton.StopAnimating();
|
||||
m_sprTopButton.SetState( 0 );
|
||||
m_sprTopButton.SetY( -BAR_HEIGHT/2 );
|
||||
this->AddSubActor( &m_sprTopButton );
|
||||
|
||||
m_sprBottomButton.Load( THEME->GetPathTo("Graphics","select music scrollbar") );
|
||||
m_sprBottomButton.Load( THEME->GetPathTo("Graphics","select music scrollbar 2x2") );
|
||||
m_sprBottomButton.StopAnimating();
|
||||
m_sprBottomButton.SetState( 2 );
|
||||
m_sprBottomButton.SetY( BAR_HEIGHT/2 );
|
||||
this->AddSubActor( &m_sprBottomButton );
|
||||
|
||||
m_sprScrollThumb.Load( THEME->GetPathTo("Graphics","select music scrollbar") );
|
||||
m_sprScrollThumb.StopAnimating();
|
||||
m_sprScrollThumb.SetState( 3 );
|
||||
m_sprScrollThumb.SetY( CENTER_Y );
|
||||
this->AddSubActor( &m_sprScrollThumb );
|
||||
SetBarHeight( 100 );
|
||||
}
|
||||
|
||||
void ScrollBar::SetPercentage( float fPercentageFromTop )
|
||||
void ScrollBar::SetBarHeight( int iHeight )
|
||||
{
|
||||
if( fPercentageFromTop < 0 ) fPercentageFromTop += 1;
|
||||
fPercentageFromTop = fmodf( fPercentageFromTop, 1 );
|
||||
float fY = -BAR_HEIGHT/2+16 + fPercentageFromTop*(BAR_HEIGHT-32);
|
||||
m_sprScrollThumb.SetY( (float)roundf(fY) );
|
||||
m_iBarHeight = iHeight;
|
||||
m_sprBackground.SetZoomY( m_iBarHeight/m_sprBackground.GetUnzoomedHeight() );
|
||||
m_sprTopButton.SetY( -m_iBarHeight/2.0f );
|
||||
m_sprBottomButton.SetY( +m_iBarHeight/2.0f );
|
||||
m_sprScrollThumbPart1.SetY( 0 );
|
||||
m_sprScrollThumbPart2.SetY( 0 );
|
||||
}
|
||||
|
||||
void ScrollBar::SetPercentage( float fStartPercent, float fEndPercent )
|
||||
{
|
||||
const int k_iBarContentHeight = m_iBarHeight - int( m_sprTopButton.GetUnzoomedHeight()/2 + m_sprBottomButton.GetUnzoomedHeight()/2 );
|
||||
|
||||
// make sure the percent numbers are between 0 and 1
|
||||
fStartPercent = fmodf( fStartPercent+1, 1 );
|
||||
fEndPercent = fmodf( fEndPercent+1, 1 );
|
||||
|
||||
int iPart1TopY, iPart1BottomY, iPart2TopY, iPart2BottomY;
|
||||
|
||||
if( fStartPercent < fEndPercent ) // we only need to one 1 thumb part
|
||||
{
|
||||
iPart1TopY = (int)SCALE( fStartPercent,0.0f, 1.0f, -k_iBarContentHeight/2.0f, +k_iBarContentHeight/2.0f );
|
||||
iPart1BottomY = (int)SCALE( fEndPercent, 0.0f, 1.0f, -k_iBarContentHeight/2.0f, +k_iBarContentHeight/2.0f );
|
||||
iPart2TopY = -1;
|
||||
iPart2BottomY = -1;
|
||||
}
|
||||
else // we need two thumb parts
|
||||
{
|
||||
iPart1TopY = (int)SCALE( 0.0f, 0.0f, 1.0f, -k_iBarContentHeight/2.0f, +k_iBarContentHeight/2.0f );
|
||||
iPart1BottomY = (int)SCALE( fEndPercent, 0.0f, 1.0f, -k_iBarContentHeight/2.0f, +k_iBarContentHeight/2.0f );
|
||||
iPart2TopY = (int)SCALE( fStartPercent,0.0f, 1.0f, -k_iBarContentHeight/2.0f, +k_iBarContentHeight/2.0f );
|
||||
iPart2BottomY = (int)SCALE( 1.0f, 0.0f, 1.0f, -k_iBarContentHeight/2.0f, +k_iBarContentHeight/2.0f );
|
||||
}
|
||||
|
||||
|
||||
m_sprScrollThumbPart1.StretchTo( CRect(
|
||||
(int)-m_sprScrollThumbPart1.GetUnzoomedWidth()/2,
|
||||
iPart1TopY,
|
||||
(int)+m_sprScrollThumbPart1.GetUnzoomedWidth()/2,
|
||||
iPart1BottomY
|
||||
) );
|
||||
|
||||
if( iPart2TopY != -1 )
|
||||
{
|
||||
m_sprScrollThumbPart2.StretchTo( CRect(
|
||||
(int)-m_sprScrollThumbPart2.GetUnzoomedWidth()/2,
|
||||
iPart2TopY,
|
||||
(int)+m_sprScrollThumbPart2.GetUnzoomedWidth()/2,
|
||||
iPart2BottomY
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sprScrollThumbPart2.SetZoomY( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,16 @@ class ScrollBar : public ActorFrame
|
||||
public:
|
||||
ScrollBar();
|
||||
|
||||
void SetPercentage( float fPercentageFromTop );
|
||||
void SetBarHeight( int iHeight );
|
||||
void SetPercentage( float fStartPercent, float fEndPercent);
|
||||
|
||||
private:
|
||||
Sprite m_sprTopButton, m_sprBottomButton;
|
||||
Sprite m_sprBackground, m_sprScrollThumb;
|
||||
protected:
|
||||
|
||||
int m_iBarHeight;
|
||||
|
||||
Sprite m_sprTopButton;
|
||||
Sprite m_sprBottomButton;
|
||||
Sprite m_sprBackground;
|
||||
Sprite m_sprScrollThumbPart1;
|
||||
Sprite m_sprScrollThumbPart2;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user