Updated for abstraction and changes to origional MusicWheel operation
This commit is contained in:
+81
-82
@@ -17,12 +17,7 @@
|
|||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
|
||||||
#define NUM_WHEEL_ITEMS ((int)ceil(NUM_WHEEL_ITEMS_TO_DRAW+2))
|
|
||||||
|
|
||||||
// leaving this one under ScreenSelectMusic because that is the only place it takes effect anyway.
|
|
||||||
//ThemeMetric<CString> DEFAULT_SORT ("ScreenSelectMusic","DefaultSort");
|
|
||||||
|
|
||||||
//static CString SECTION_COLORS_NAME( size_t i ) { return ssprintf("SectionColor%d",int(i+1)); }
|
|
||||||
static CString CHOICE_NAME( CString s ) { return ssprintf("Choice%s",s.c_str()); }
|
static CString CHOICE_NAME( CString s ) { return ssprintf("Choice%s",s.c_str()); }
|
||||||
|
|
||||||
const int MAX_WHEEL_SOUND_SPEED = 15;
|
const int MAX_WHEEL_SOUND_SPEED = 15;
|
||||||
@@ -49,7 +44,6 @@ void WheelBase::Load( CString sType )
|
|||||||
|
|
||||||
LoadFromMetrics( sType );
|
LoadFromMetrics( sType );
|
||||||
LoadVariables();
|
LoadVariables();
|
||||||
// SECTION_COLORS .Load(sType,SECTION_COLORS_NAME,NUM_SECTION_COLORS);
|
|
||||||
|
|
||||||
FOREACH( WheelItemBase*, m_WheelBaseItems, i )
|
FOREACH( WheelItemBase*, m_WheelBaseItems, i )
|
||||||
SAFE_DELETE( *i );
|
SAFE_DELETE( *i );
|
||||||
@@ -184,11 +178,8 @@ void WheelBase::DrawPrimitives()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WheelBase::DrawItem( int i )
|
void WheelBase::DrawItem( int i, WheelItemBase *display, const float fThisBannerPositionOffsetFromSelection)
|
||||||
{
|
{
|
||||||
WheelItemBase *display = m_WheelBaseItems[i];
|
|
||||||
|
|
||||||
const float fThisBannerPositionOffsetFromSelection = i - NUM_WHEEL_ITEMS/2 + m_fPositionOffsetFromSelection;
|
|
||||||
if( fabsf(fThisBannerPositionOffsetFromSelection) > NUM_WHEEL_ITEMS_TO_DRAW/2 )
|
if( fabsf(fThisBannerPositionOffsetFromSelection) > NUM_WHEEL_ITEMS_TO_DRAW/2 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -210,10 +201,9 @@ void WheelBase::DrawItem( int i )
|
|||||||
display->Draw();
|
display->Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WheelBase::UpdateScrollbar(unsigned int size)
|
||||||
void WheelBase::UpdateScrollbar()
|
|
||||||
{
|
{
|
||||||
int total_num_items = m_WheelBaseItemsData.size();
|
int total_num_items = size;
|
||||||
float item_at=m_iSelection - m_fPositionOffsetFromSelection;
|
float item_at=m_iSelection - m_fPositionOffsetFromSelection;
|
||||||
|
|
||||||
if(NUM_WHEEL_ITEMS >= total_num_items)
|
if(NUM_WHEEL_ITEMS >= total_num_items)
|
||||||
@@ -245,11 +235,8 @@ void WheelBase::Update( float fDeltaTime )
|
|||||||
{
|
{
|
||||||
ActorFrame::Update( fDeltaTime );
|
ActorFrame::Update( fDeltaTime );
|
||||||
|
|
||||||
for( unsigned i = 0; i < unsigned(NUM_WHEEL_ITEMS); i++)
|
UpdateItems(fDeltaTime);
|
||||||
{
|
|
||||||
m_WheelBaseItems[i]->Update( fDeltaTime );
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
//Moved to CommonUpdateProcedure, seems to work fine
|
//Moved to CommonUpdateProcedure, seems to work fine
|
||||||
//Revert if it happens to break something
|
//Revert if it happens to break something
|
||||||
UpdateScrollbar();
|
UpdateScrollbar();
|
||||||
@@ -259,58 +246,14 @@ void WheelBase::Update( float fDeltaTime )
|
|||||||
m_TimeBeforeMovingBegins -= fDeltaTime;
|
m_TimeBeforeMovingBegins -= fDeltaTime;
|
||||||
m_TimeBeforeMovingBegins = max(m_TimeBeforeMovingBegins, 0);
|
m_TimeBeforeMovingBegins = max(m_TimeBeforeMovingBegins, 0);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
// update wheel state
|
// update wheel state
|
||||||
m_fTimeLeftInState -= fDeltaTime;
|
m_fTimeLeftInState -= fDeltaTime;
|
||||||
if( m_fTimeLeftInState <= 0 ) // time to go to a new state
|
if( m_fTimeLeftInState <= 0 ) // time to go to a new state
|
||||||
{
|
{
|
||||||
switch( m_WheelState )
|
UpdateSwitch();
|
||||||
{
|
|
||||||
case STATE_TWEENING_ON_SCREEN:
|
|
||||||
m_fTimeLeftInState = 0;
|
|
||||||
if( (GAMESTATE->IsExtraStage() && !PREFSMAN->m_bPickExtraStage) || GAMESTATE->IsExtraStage2() )
|
|
||||||
{
|
|
||||||
m_WheelState = STATE_LOCKED;
|
|
||||||
SCREENMAN->PlayStartSound();
|
|
||||||
m_fLockedWheelVelocity = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_WheelState = STATE_SELECTING_GENERIC;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STATE_TWEENING_OFF_SCREEN:
|
|
||||||
m_WheelState = STATE_WAITING_OFF_SCREEN;
|
|
||||||
m_fTimeLeftInState = 0;
|
|
||||||
break;
|
|
||||||
case STATE_SELECTING_GENERIC:
|
|
||||||
m_fTimeLeftInState = 0;
|
|
||||||
break;
|
|
||||||
case STATE_WAITING_OFF_SCREEN:
|
|
||||||
break;
|
|
||||||
case STATE_LOCKED:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ASSERT(0); // all state changes should be handled explicitly
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonUpdateProcedure(fDeltaTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WheelBase::CommonUpdateProcedure(float fDeltaTime) {
|
|
||||||
|
|
||||||
//This bit of code now happens after it's normal execution, but it seems to work fine.
|
|
||||||
UpdateScrollbar();
|
|
||||||
|
|
||||||
if( m_Moving )
|
|
||||||
{
|
|
||||||
m_TimeBeforeMovingBegins -= fDeltaTime;
|
|
||||||
m_TimeBeforeMovingBegins = max(m_TimeBeforeMovingBegins, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//The following code is just fine here.
|
|
||||||
if( m_WheelState == STATE_LOCKED )
|
if( m_WheelState == STATE_LOCKED )
|
||||||
{
|
{
|
||||||
/* Do this in at most .1 sec chunks, so we don't get weird if we
|
/* Do this in at most .1 sec chunks, so we don't get weird if we
|
||||||
@@ -388,6 +331,46 @@ void WheelBase::CommonUpdateProcedure(float fDeltaTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WheelBase::UpdateItems(float fDeltaTime) {
|
||||||
|
for( unsigned i = 0; i < unsigned(NUM_WHEEL_ITEMS); i++)
|
||||||
|
{
|
||||||
|
m_WheelBaseItems[i]->Update( fDeltaTime );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WheelBase::UpdateSwitch() {
|
||||||
|
switch( m_WheelState )
|
||||||
|
{
|
||||||
|
case STATE_TWEENING_ON_SCREEN:
|
||||||
|
m_fTimeLeftInState = 0;
|
||||||
|
if( (GAMESTATE->IsExtraStage() && !PREFSMAN->m_bPickExtraStage) || GAMESTATE->IsExtraStage2() )
|
||||||
|
{
|
||||||
|
m_WheelState = STATE_LOCKED;
|
||||||
|
SCREENMAN->PlayStartSound();
|
||||||
|
m_fLockedWheelVelocity = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_WheelState = STATE_SELECTING_GENERIC;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case STATE_TWEENING_OFF_SCREEN:
|
||||||
|
m_WheelState = STATE_WAITING_OFF_SCREEN;
|
||||||
|
m_fTimeLeftInState = 0;
|
||||||
|
break;
|
||||||
|
case STATE_SELECTING_GENERIC:
|
||||||
|
m_fTimeLeftInState = 0;
|
||||||
|
break;
|
||||||
|
case STATE_WAITING_OFF_SCREEN:
|
||||||
|
break;
|
||||||
|
case STATE_LOCKED:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0); // all state changes should be handled explicitly
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool WheelBase::Select() // return true if this selection ends the screen
|
bool WheelBase::Select() // return true if this selection ends the screen
|
||||||
{
|
{
|
||||||
LOG->Trace( "WheelBase::Select()" );
|
LOG->Trace( "WheelBase::Select()" );
|
||||||
@@ -450,6 +433,15 @@ void WheelBase::TweenOnScreen(bool changing_sort)
|
|||||||
m_ScrollBar.BeginTweening( 0.2f , Actor::TWEEN_ACCELERATE );
|
m_ScrollBar.BeginTweening( 0.2f , Actor::TWEEN_ACCELERATE );
|
||||||
m_ScrollBar.AddX( -30 );
|
m_ScrollBar.AddX( -30 );
|
||||||
|
|
||||||
|
TweenOnScreenUpdateItems(changing_sort);
|
||||||
|
|
||||||
|
if( changing_sort )
|
||||||
|
HurryTweening( 0.25f );
|
||||||
|
|
||||||
|
m_fTimeLeftInState = GetTweenTimeLeft() + 0.100f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WheelBase::TweenOnScreenUpdateItems(bool changing_sort) {
|
||||||
for( int i=0; i<NUM_WHEEL_ITEMS; i++ )
|
for( int i=0; i<NUM_WHEEL_ITEMS; i++ )
|
||||||
{
|
{
|
||||||
WheelItemBase *display = m_WheelBaseItems[i];
|
WheelItemBase *display = m_WheelBaseItems[i];
|
||||||
@@ -463,11 +455,6 @@ void WheelBase::TweenOnScreen(bool changing_sort)
|
|||||||
if( changing_sort )
|
if( changing_sort )
|
||||||
display->HurryTweening( 0.25f );
|
display->HurryTweening( 0.25f );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( changing_sort )
|
|
||||||
HurryTweening( 0.25f );
|
|
||||||
|
|
||||||
m_fTimeLeftInState = GetTweenTimeLeft() + 0.100f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WheelBase::TweenOffScreen(bool changing_sort)
|
void WheelBase::TweenOffScreen(bool changing_sort)
|
||||||
@@ -493,6 +480,16 @@ void WheelBase::TweenOffScreen(bool changing_sort)
|
|||||||
m_ScrollBar.BeginTweening( 0.2f, Actor::TWEEN_ACCELERATE );
|
m_ScrollBar.BeginTweening( 0.2f, Actor::TWEEN_ACCELERATE );
|
||||||
m_ScrollBar.SetX( SCROLL_BAR_X+30 );
|
m_ScrollBar.SetX( SCROLL_BAR_X+30 );
|
||||||
|
|
||||||
|
TweenOffScreenUpdateItems(changing_sort);
|
||||||
|
|
||||||
|
if( changing_sort )
|
||||||
|
HurryTweening( 0.25f );
|
||||||
|
|
||||||
|
m_fTimeLeftInState = GetTweenTimeLeft() + 0.100f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WheelBase::TweenOffScreenUpdateItems(bool changing_sort)
|
||||||
|
{
|
||||||
for( int i=0; i<NUM_WHEEL_ITEMS; i++ )
|
for( int i=0; i<NUM_WHEEL_ITEMS; i++ )
|
||||||
{
|
{
|
||||||
WheelItemBase *display = m_WheelBaseItems[i];
|
WheelItemBase *display = m_WheelBaseItems[i];
|
||||||
@@ -506,11 +503,6 @@ void WheelBase::TweenOffScreen(bool changing_sort)
|
|||||||
if( changing_sort )
|
if( changing_sort )
|
||||||
display->HurryTweening( 0.25f );
|
display->HurryTweening( 0.25f );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( changing_sort )
|
|
||||||
HurryTweening( 0.25f );
|
|
||||||
|
|
||||||
m_fTimeLeftInState = GetTweenTimeLeft() + 0.100f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WheelBase::Move(int n)
|
void WheelBase::Move(int n)
|
||||||
@@ -529,6 +521,18 @@ void WheelBase::Move(int n)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!MoveSpecific(n))
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_TimeBeforeMovingBegins = 1/4.0f;
|
||||||
|
m_SpinSpeed = float(PREFSMAN->m_iMusicWheelSwitchSpeed);
|
||||||
|
m_Moving = n;
|
||||||
|
|
||||||
|
if(m_Moving)
|
||||||
|
ChangeMusic(m_Moving);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WheelBase::MoveSpecific(int n) {
|
||||||
/* If we're not selecting, discard this. We won't ignore it; we'll
|
/* If we're not selecting, discard this. We won't ignore it; we'll
|
||||||
* get called again every time the key is repeated. */
|
* get called again every time the key is repeated. */
|
||||||
/* Still process Move(0) so we sometimes continue moving immediate
|
/* Still process Move(0) so we sometimes continue moving immediate
|
||||||
@@ -541,10 +545,10 @@ void WheelBase::Move(int n)
|
|||||||
case STATE_FLYING_OFF_BEFORE_NEXT_SORT:
|
case STATE_FLYING_OFF_BEFORE_NEXT_SORT:
|
||||||
case STATE_FLYING_ON_AFTER_NEXT_SORT:
|
case STATE_FLYING_ON_AFTER_NEXT_SORT:
|
||||||
if( n!= 0 )
|
if( n!= 0 )
|
||||||
return;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return; // don't continue
|
return false; // don't continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_Moving != 0 && n == 0 && m_TimeBeforeMovingBegins == 0)
|
if(m_Moving != 0 && n == 0 && m_TimeBeforeMovingBegins == 0)
|
||||||
@@ -560,12 +564,7 @@ void WheelBase::Move(int n)
|
|||||||
// SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 );
|
// SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_TimeBeforeMovingBegins = 1/4.0f;
|
return true;
|
||||||
m_SpinSpeed = float(PREFSMAN->m_iMusicWheelSwitchSpeed);
|
|
||||||
m_Moving = n;
|
|
||||||
|
|
||||||
if(m_Moving)
|
|
||||||
ChangeMusic(m_Moving);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WheelBase::AddItem(WheelItemBaseData* itemdata)
|
void WheelBase::AddItem(WheelItemBaseData* itemdata)
|
||||||
|
|||||||
+17
-15
@@ -13,9 +13,7 @@
|
|||||||
#include "WheelItemBase.h"
|
#include "WheelItemBase.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
|
||||||
//AutoScreenMessage( SM_SongChanged ); // TODO: Replace this with a Message and MESSAGEMAN
|
#define NUM_WHEEL_ITEMS ((int)ceil(NUM_WHEEL_ITEMS_TO_DRAW+2))
|
||||||
|
|
||||||
//struct CompareSongPointerArrayBySectionName;
|
|
||||||
|
|
||||||
class WheelBase : public ActorFrame
|
class WheelBase : public ActorFrame
|
||||||
{
|
{
|
||||||
@@ -26,24 +24,25 @@ public:
|
|||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
void DrawItem( int index );
|
virtual void DrawItem( int i, WheelItemBase *display, const float fThisBannerPositionOffsetFromSelection);
|
||||||
|
virtual void DrawItem( int i ) { DrawItem( i, m_WheelBaseItems[i], i - NUM_WHEEL_ITEMS/2 + m_fPositionOffsetFromSelection ); }
|
||||||
|
|
||||||
virtual void TweenOnScreen(bool changing_sort);
|
void TweenOnScreen(bool changing_sort);
|
||||||
virtual void TweenOffScreen(bool changing_sort);
|
void TweenOffScreen(bool changing_sort);
|
||||||
virtual void TweenOnScreen() { TweenOnScreen(false); }
|
void TweenOnScreen() { TweenOnScreen(false); }
|
||||||
virtual void TweenOffScreen() { TweenOffScreen(false); }
|
void TweenOffScreen() { TweenOffScreen(false); }
|
||||||
|
|
||||||
void Move(int n);
|
void Move(int n);
|
||||||
virtual void ChangeMusic(int dist); /* +1 or -1 */
|
virtual void ChangeMusic(int dist); /* +1 or -1 */
|
||||||
|
|
||||||
/* Return true if we're moving fast automatically. */
|
/* Return true if we're moving fast automatically. */
|
||||||
int IsMoving() const;
|
int IsMoving() const;
|
||||||
bool IsSettled() const;
|
virtual bool IsSettled() const;
|
||||||
|
|
||||||
void GetItemPosition( float fPosOffsetsFromMiddle, float& fX_out, float& fY_out, float& fZ_out, float& fRotationX_out );
|
void GetItemPosition( float fPosOffsetsFromMiddle, float& fX_out, float& fY_out, float& fZ_out, float& fRotationX_out );
|
||||||
void SetItemPosition( Actor &item, float fPosOffsetsFromMiddle );
|
void SetItemPosition( Actor &item, float fPosOffsetsFromMiddle );
|
||||||
|
|
||||||
bool Select(); // return true if this selection ends the screen
|
virtual bool Select(); // return true if this selection ends the screen
|
||||||
|
|
||||||
bool WheelIsLocked() { return (m_WheelState == STATE_LOCKED ? true : false); }
|
bool WheelIsLocked() { return (m_WheelState == STATE_LOCKED ? true : false); }
|
||||||
void RebuildWheelItems( int dist = -999999 ); // -999999 = refresh all
|
void RebuildWheelItems( int dist = -999999 ); // -999999 = refresh all
|
||||||
@@ -53,12 +52,15 @@ public:
|
|||||||
WheelItemBaseData* LastSelected();
|
WheelItemBaseData* LastSelected();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void LoadFromMetrics( CString sType );
|
void LoadFromMetrics( CString sType );
|
||||||
void LoadVariables();
|
void LoadVariables();
|
||||||
void CommonUpdateProcedure(float fDeltaTime);
|
virtual void UpdateSwitch();
|
||||||
|
virtual void UpdateItems(float fDeltaTime);
|
||||||
|
virtual void TweenOnScreenUpdateItems(bool changing_sort);
|
||||||
|
virtual void TweenOffScreenUpdateItems(bool changing_sort);
|
||||||
|
virtual bool MoveSpecific(int n);
|
||||||
|
|
||||||
virtual void BuildWheelItemsData( vector<WheelItemBaseData *> &arrayWheelItemDatas );
|
virtual void BuildWheelItemsData( vector<WheelItemBaseData *> &arrayWheelItemDatas );
|
||||||
// bool SelectModeMenuItem();
|
|
||||||
int FirstVisibleIndex();
|
int FirstVisibleIndex();
|
||||||
|
|
||||||
ScrollBar m_ScrollBar;
|
ScrollBar m_ScrollBar;
|
||||||
@@ -102,7 +104,8 @@ protected:
|
|||||||
RageSound m_soundLocked;
|
RageSound m_soundLocked;
|
||||||
|
|
||||||
// bool WheelItemIsVisible(int n);
|
// bool WheelItemIsVisible(int n);
|
||||||
void UpdateScrollbar();
|
virtual inline void UpdateScrollbar() { UpdateScrollbar(m_WheelBaseItemsData.size()); }
|
||||||
|
void UpdateScrollbar(unsigned int size);
|
||||||
|
|
||||||
ThemeMetric<float> SWITCH_SECONDS;
|
ThemeMetric<float> SWITCH_SECONDS;
|
||||||
ThemeMetric<float> LOCKED_INITIAL_VELOCITY;
|
ThemeMetric<float> LOCKED_INITIAL_VELOCITY;
|
||||||
@@ -119,7 +122,6 @@ protected:
|
|||||||
ThemeMetric<float> WHEEL_ITEM_ON_DELAY_OFFSET;
|
ThemeMetric<float> WHEEL_ITEM_ON_DELAY_OFFSET;
|
||||||
ThemeMetric<float> WHEEL_ITEM_OFF_DELAY_CENTER;
|
ThemeMetric<float> WHEEL_ITEM_OFF_DELAY_CENTER;
|
||||||
ThemeMetric<float> WHEEL_ITEM_OFF_DELAY_OFFSET;
|
ThemeMetric<float> WHEEL_ITEM_OFF_DELAY_OFFSET;
|
||||||
// ThemeMetric1D<RageColor> SECTION_COLORS;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,19 +14,11 @@
|
|||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
#include "ThemeMetric.h"
|
||||||
|
|
||||||
|
ThemeMetric<float> TEXT_X ("WheelItemBase","TextX");
|
||||||
// WheelItem stuff
|
ThemeMetric<float> TEXT_Y ("WheelItemBase","TextY");
|
||||||
#define ICON_X THEME->GetMetricF("WheelItemBase","IconX")
|
ThemeMetric<apActorCommands> TEXT_ON_COMMAND ("WheelItemBase","TextOnCommand");
|
||||||
#define SONG_NAME_X THEME->GetMetricF("WheelItemBase","SongNameX")
|
|
||||||
#define SECTION_NAME_X THEME->GetMetricF("WheelItemBase","SectionNameX")
|
|
||||||
#define SECTION_ZOOM THEME->GetMetricF("WheelItemBase","SectionZoom")
|
|
||||||
#define ROULETTE_X THEME->GetMetricF("WheelItemBase","RouletteX")
|
|
||||||
#define ROULETTE_ZOOM THEME->GetMetricF("WheelItemBase","RouletteZoom")
|
|
||||||
#define GRADE_X( p ) THEME->GetMetricF("WheelItemBase",ssprintf("GradeP%dX",p+1))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WheelItemBaseData::WheelItemBaseData( WheelItemType wit, CString sText, RageColor color )
|
WheelItemBaseData::WheelItemBaseData( WheelItemType wit, CString sText, RageColor color )
|
||||||
{
|
{
|
||||||
@@ -39,22 +31,19 @@ WheelItemBaseData::WheelItemBaseData( WheelItemType wit, CString sText, RageColo
|
|||||||
|
|
||||||
WheelItemBase::WheelItemBase()
|
WheelItemBase::WheelItemBase()
|
||||||
{
|
{
|
||||||
// data = new WheelItemBaseData;
|
|
||||||
// data->m_Type = TYPE_GENERIC;
|
|
||||||
SetName( "WheelItemBase" );
|
SetName( "WheelItemBase" );
|
||||||
|
|
||||||
m_fPercentGray = 0;
|
m_fPercentGray = 0;
|
||||||
|
|
||||||
m_sprBar.Load( THEME->GetPathG("WheelItemBase","bar") );
|
m_sprBar.Load( THEME->GetPathG("WheelItemBase","bar") );
|
||||||
m_sprBar.SetXY( 0, 0 );
|
m_sprBar.SetXY( 0, 0 );
|
||||||
m_All.AddChild( &m_sprBar );
|
this->AddChild( &m_sprBar );
|
||||||
|
|
||||||
m_text.LoadFromFont( THEME->GetPathF("WheelItemBase","text") );
|
m_text.LoadFromFont( THEME->GetPathF("WheelItemBase","text") );
|
||||||
m_text.SetShadowLength( 0 );
|
m_text.SetShadowLength( 0 );
|
||||||
m_text.SetVertAlign( align_middle );
|
m_text.SetXY( TEXT_X, TEXT_Y );
|
||||||
m_text.SetXY( SECTION_NAME_X, 0 );
|
m_text.RunCommands( TEXT_ON_COMMAND );
|
||||||
m_text.SetZoom( SECTION_ZOOM );
|
this->AddChild( &m_text );
|
||||||
m_All.AddChild( &m_text );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WheelItemBase::LoadFromWheelItemBaseData( WheelItemBaseData* pWID )
|
void WheelItemBase::LoadFromWheelItemBaseData( WheelItemBaseData* pWID )
|
||||||
@@ -84,69 +73,22 @@ void WheelItemBase::LoadFromWheelItemBaseData( WheelItemBaseData* pWID )
|
|||||||
void WheelItemBase::Update( float fDeltaTime )
|
void WheelItemBase::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
Actor::Update( fDeltaTime );
|
Actor::Update( fDeltaTime );
|
||||||
|
|
||||||
switch( data->m_Type )
|
|
||||||
{
|
|
||||||
case TYPE_GENERIC:
|
|
||||||
m_sprBar.Update( fDeltaTime );
|
|
||||||
m_text.Update( fDeltaTime );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;//ASSERT(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WheelItemBase::DrawPrimitives()
|
void WheelItemBase::DrawPrimitives(Sprite& bar)
|
||||||
{
|
{
|
||||||
Sprite *bar = NULL;
|
ActorFrame::DrawPrimitives();
|
||||||
|
|
||||||
switch( data->m_Type )
|
|
||||||
{
|
|
||||||
case TYPE_GENERIC:
|
|
||||||
bar = &m_sprBar;
|
|
||||||
break;
|
|
||||||
default: ASSERT(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bar = &m_sprBar;
|
|
||||||
bar->Draw();
|
|
||||||
m_text.Draw();
|
|
||||||
switch( data->m_Type )
|
|
||||||
{
|
|
||||||
case TYPE_GENERIC:
|
|
||||||
m_text.Draw();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ASSERT(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_fPercentGray > 0 )
|
if( m_fPercentGray > 0 )
|
||||||
{
|
{
|
||||||
bar->SetGlow( RageColor(0,0,0,m_fPercentGray) );
|
bar.SetGlow( RageColor(0,0,0,m_fPercentGray) );
|
||||||
bar->SetDiffuse( RageColor(0,0,0,0) );
|
bar.SetDiffuse( RageColor(0,0,0,0) );
|
||||||
bar->Draw();
|
bar.Draw();
|
||||||
bar->SetDiffuse( RageColor(0,0,0,1) );
|
bar.SetDiffuse( RageColor(0,0,0,1) );
|
||||||
bar->SetGlow( RageColor(0,0,0,0) );
|
bar.SetGlow( RageColor(0,0,0,0) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WheelItemBase::SetZTestMode( ZTestMode mode )
|
|
||||||
{
|
|
||||||
ActorFrame::SetZTestMode( mode );
|
|
||||||
|
|
||||||
// set all sub-Actors
|
|
||||||
m_All.SetZTestMode( mode );
|
|
||||||
}
|
|
||||||
|
|
||||||
void WheelItemBase::SetZWrite( bool b )
|
|
||||||
{
|
|
||||||
ActorFrame::SetZWrite( b );
|
|
||||||
|
|
||||||
// set all sub-Actors
|
|
||||||
m_All.SetZWrite( b );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford, Chris Gomez, Glenn Maynard, Josh Allen
|
* (c) 2001-2004 Chris Danford, Chris Gomez, Glenn Maynard, Josh Allen
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -16,7 +16,13 @@ struct WheelItemBaseData;
|
|||||||
enum WheelItemType
|
enum WheelItemType
|
||||||
{
|
{
|
||||||
TYPE_GENERIC,
|
TYPE_GENERIC,
|
||||||
TYPE_GROUP
|
TYPE_SECTION,
|
||||||
|
TYPE_SONG,
|
||||||
|
TYPE_ROULETTE,
|
||||||
|
TYPE_RANDOM,
|
||||||
|
TYPE_PORTAL,
|
||||||
|
TYPE_COURSE,
|
||||||
|
TYPE_SORT
|
||||||
};
|
};
|
||||||
|
|
||||||
class WheelItemBase : public ActorFrame
|
class WheelItemBase : public ActorFrame
|
||||||
@@ -25,23 +31,18 @@ public:
|
|||||||
WheelItemBase();
|
WheelItemBase();
|
||||||
WheelItemBaseData* data;
|
WheelItemBaseData* data;
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives(Sprite& bar);
|
||||||
virtual void SetZTestMode( ZTestMode mode );
|
virtual void DrawPrimitives() { DrawPrimitives( m_sprBar ); }
|
||||||
virtual void SetZWrite( bool b );
|
|
||||||
|
|
||||||
virtual void LoadFromWheelItemBaseData( WheelItemBaseData* pWID );
|
virtual void LoadFromWheelItemBaseData( WheelItemBaseData* pWID );
|
||||||
|
|
||||||
float m_fPercentGray;
|
float m_fPercentGray;
|
||||||
|
|
||||||
// for TYPE_GENERIC
|
|
||||||
Sprite m_sprBar;
|
Sprite m_sprBar;
|
||||||
BitmapText m_text;
|
BitmapText m_text;
|
||||||
|
|
||||||
WheelItemType m_Type;
|
WheelItemType m_Type;
|
||||||
RageColor m_color;
|
RageColor m_color;
|
||||||
|
|
||||||
// for TYPE_SORT
|
|
||||||
ActorFrame m_All;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WheelItemBaseData
|
struct WheelItemBaseData
|
||||||
@@ -53,10 +54,6 @@ struct WheelItemBaseData
|
|||||||
CString m_sText;
|
CString m_sText;
|
||||||
RageColor m_color; // either text color or section background color
|
RageColor m_color; // either text color or section background color
|
||||||
WheelNotifyIcon::Flags m_Flags;
|
WheelNotifyIcon::Flags m_Flags;
|
||||||
|
|
||||||
// for TYPE_SORT
|
|
||||||
// CString m_sLabel;
|
|
||||||
// GameCommand m_Action;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user