Esempio n. 1
0
void LifeMeterBar::Update( float fDeltaTime )
{
	LifeMeter::Update( fDeltaTime );


	// HACK:  Tweaking these values is very difficulty.  Update the
	// "physics" many times so that the spring motion appears faster

	for( int i=0; i<10; i++ )
	{

		const float fDelta = m_fLifePercentage - m_fTrailingLifePercentage;

		const float fSpringForce = fDelta * 2.0f;
		m_fLifeVelocity += fSpringForce * fDeltaTime;

		const float fViscousForce = -m_fLifeVelocity * 0.2f;
		m_fLifeVelocity += fViscousForce * fDeltaTime;

		CLAMP( m_fLifeVelocity, -.06f, +.02f );

		m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime;
	}

	m_fHotAlpha  += IsHot() ? + fDeltaTime*2 : -fDeltaTime*2;
	CLAMP( m_fHotAlpha, 0, 1 );

	if( IsHot() )
		m_fLifeVelocity = max( 0, m_fLifeVelocity );
}
Esempio n. 2
0
LONG CSkinItemEdit::GetBorderHelper(LONG clrNormal, LONG clrHover, LONG clrFocus, LONG clrReadOnly, LONG clrDisabled)
{
    LONG color = 0;

    if (IsReadOnly() && m_bReadOnlyBorder) {
        color = clrReadOnly;
    } else if (IsFocused() && m_bFocusBorder) {
        color = clrFocus;
    } else if (IsHot()) {
        color = clrHover;
    } else {
        color = clrNormal;
    }

    if (GetDisabled())
        color = clrDisabled;

    if (color == -1)
        color = clrNormal;

    if (color == -1)
        return -1;

    if (GetColorTransform()) {
        GetEngine()->TransformColor(color, color);
    }

    return color;
}
Esempio n. 3
0
void LifeMeterBar::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
{
    /* The initial tap note score (which we happen to have in have in
     * tscore) has already been reported to the above function.  If the
     * hold end result was an NG, count it as a miss; if the end result
     * was an OK, count a perfect.  (Remember, this is just life meter
     * computation, not scoring.) */
    float fDeltaLife=0.f;
    switch( GAMESTATE->m_SongOptions.m_DrainType )
    {
    case SongOptions::DRAIN_NORMAL:
        switch( score )
        {
        case HNS_OK:
            fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeOK;
            break;
        case HNS_NG:
            fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeNG;
            break;
        default:
            ASSERT(0);
        }
        if( IsHot()  &&  score == HNS_NG )
            fDeltaLife = -0.10f;		// make it take a while to get back to "doing great"
        break;
    case SongOptions::DRAIN_NO_RECOVER:
        switch( score )
        {
        case HNS_OK:
            fDeltaLife = +0.000f;
            break;
        case HNS_NG:
            fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeNG;
            break;
        default:
            ASSERT(0);
        }
        break;
    case SongOptions::DRAIN_SUDDEN_DEATH:
        switch( score )
        {
        case HNS_OK:
            fDeltaLife = +0;
            break;
        case HNS_NG:
            fDeltaLife = -1.0;
            break;
        default:
            ASSERT(0);
        }
        break;
    default:
        ASSERT(0);
    }

    ChangeLife( fDeltaLife );
}
Esempio n. 4
0
void MeaRulerSlider::OnLButtonDown(UINT /* nFlags */, CPoint point)
{
    SetCapture();
    m_captured = true;

    if (IsHot(m_vertical ? point.y : point.x)) {
        SetCursor(LoadCursor(NULL, m_vertical ? IDC_SIZENS : IDC_SIZEWE));
        m_sliderActive = true;
        
        Invalidate(TRUE);
    }
}
Esempio n. 5
0
void LifeMeterBar::ChangeLife( TapNoteScore score )
{
	float fDeltaLife=0.f;
	switch( GAMESTATE->m_SongOptions.m_DrainType )
	{
	case SongOptions::DRAIN_NORMAL:
		switch( score )
		{
		case TNS_MARVELOUS:	fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeMarvelous;	break;
		case TNS_PERFECT:	fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangePerfect;	break;
		case TNS_GREAT:		fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeGreat;		break;
		case TNS_GOOD:		fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeGood;		break;
		case TNS_BOO:		fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeBoo;		break;
		case TNS_MISS:		fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeMiss;		break;
		default:
			ASSERT(0);
		}
		if( IsHot()  &&  score < TNS_GOOD )
			fDeltaLife = -0.10f;		// make it take a while to get back to "doing great"
		break;
	case SongOptions::DRAIN_NO_RECOVER:
		switch( score )
		{
		case TNS_MARVELOUS:	fDeltaLife = +0.000f;	break;
		case TNS_PERFECT:	fDeltaLife = +0.000f;	break;
		case TNS_GREAT:		fDeltaLife = +0.000f;	break;
		case TNS_GOOD:		fDeltaLife = +0.000f;	break;
		case TNS_BOO:		fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeBoo;	break;
		case TNS_MISS:		fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeMiss;	break;
		default:
			ASSERT(0);
		}
		break;
	case SongOptions::DRAIN_SUDDEN_DEATH:
		switch( score )
		{
		case TNS_MARVELOUS:	fDeltaLife = +0;	break;
		case TNS_PERFECT:	fDeltaLife = +0;	break;
		case TNS_GREAT:		fDeltaLife = +0;	break;
		case TNS_GOOD:		fDeltaLife = -1.0;	break;
		case TNS_BOO:		fDeltaLife = -1.0;	break;
		case TNS_MISS:		fDeltaLife = -1.0;	break;
		default:
			ASSERT(0);
		}
		break;
	default:
		ASSERT(0);
	}

	ChangeLife( fDeltaLife );
}
void LifeMeterBar::Update( float fDeltaTime )
{
	LifeMeter::Update( fDeltaTime );

	m_fPassingAlpha += !IsFailing() ? +fDeltaTime*2 : -fDeltaTime*2;
	CLAMP( m_fPassingAlpha, 0, 1 );

	m_fHotAlpha  += IsHot() ? + fDeltaTime*2 : -fDeltaTime*2;
	CLAMP( m_fHotAlpha, 0, 1 );

	m_pStream->SetPassingAlpha( m_fPassingAlpha );
	m_pStream->SetHotAlpha( m_fHotAlpha );

	if( m_pPlayerState->m_HealthState == HealthState_Danger )
		m_sprDanger->SetVisible( true );
	else
		m_sprDanger->SetVisible( false );
}
Esempio n. 7
0
void LifeMeterBar::Update( float fDeltaTime )
{
    LifeMeter::Update( fDeltaTime );

    m_fPassingAlpha += IsPastPassmark() ? +fDeltaTime*2 : -fDeltaTime*2;
    CLAMP( m_fPassingAlpha, 0, 1 );

    m_fHotAlpha  += IsHot() ? + fDeltaTime*2 : -fDeltaTime*2;
    CLAMP( m_fHotAlpha, 0, 1 );

    m_pStream->SetPassingAlpha( m_fPassingAlpha );
    m_pStream->SetHotAlpha( m_fHotAlpha );

    if( m_fLifePercentage < DANGER_THRESHOLD && !GAMESTATE->IsPlayerDead(m_PlayerNumber) )
        m_quadDangerGlow.SetDiffuseAlpha( 1 );
    else
        m_quadDangerGlow.SetDiffuseAlpha( 0 );
}
Esempio n. 8
0
void LifeMeterBar::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
{
	float fDeltaLife=0.f;
	DrainType dtype = m_pPlayerState->m_PlayerOptions.GetSong().m_DrainType;
	switch( dtype )
	{
	case DrainType_Normal:
		switch( score )
		{
		case HNS_Held:		fDeltaLife = m_fLifePercentChange.GetValue(SE_Held);	break;
		case HNS_LetGo:	fDeltaLife = m_fLifePercentChange.GetValue(SE_LetGo);	break;
		case HNS_Missed:	fDeltaLife = m_fLifePercentChange.GetValue(SE_Missed);	break;
		default:
			FAIL_M(ssprintf("Invalid HoldNoteScore: %i", score));
		}
		if(PREFSMAN->m_HarshHotLifePenalty && IsHot()  &&  score == HNS_LetGo)
			fDeltaLife = -0.10f;		// make it take a while to get back to "hot"
		break;
	case DrainType_NoRecover:
		switch( score )
		{
		case HNS_Held:		fDeltaLife = +0.000f;	break;
		case HNS_LetGo:	fDeltaLife = m_fLifePercentChange.GetValue(SE_LetGo);	break;
		case HNS_Missed:		fDeltaLife = +0.000f;	break;
		default:
			FAIL_M(ssprintf("Invalid HoldNoteScore: %i", score));
		}
		break;
	case DrainType_SuddenDeath:
		switch( score )
		{
		case HNS_Held:		fDeltaLife = +0;	break;
		case HNS_LetGo:	fDeltaLife = -1.0f;	break;
		case HNS_Missed:	fDeltaLife = +0;	break;
		default:
			FAIL_M(ssprintf("Invalid HoldNoteScore: %i", score));
		}
		break;
	default:
		FAIL_M(ssprintf("Invalid DrainType: %i", dtype));
	}

	ChangeLife( fDeltaLife );
}
void LifeMeterBar::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
{
	float fDeltaLife=0.f;
	switch( GAMESTATE->m_SongOptions.GetSong().m_DrainType )
	{
	case SongOptions::DRAIN_NORMAL:
		switch( score )
		{
		case HNS_Held:		fDeltaLife = m_fLifePercentChange.GetValue(SE_Held);	break;
		case HNS_LetGo:	fDeltaLife = m_fLifePercentChange.GetValue(SE_LetGo);	break;
		default:
			ASSERT(0);
		}
		if( IsHot()  &&  score == HNS_LetGo )
			fDeltaLife = -0.10f;		// make it take a while to get back to "hot"
		break;
	case SongOptions::DRAIN_NO_RECOVER:
		switch( score )
		{
		case HNS_Held:		fDeltaLife = +0.000f;	break;
		case HNS_LetGo:	fDeltaLife = m_fLifePercentChange.GetValue(SE_LetGo);	break;
		default:
			ASSERT(0);
		}
		break;
	case SongOptions::DRAIN_SUDDEN_DEATH:
		switch( score )
		{
		case HNS_Held:		fDeltaLife = +0;	break;
		case HNS_LetGo:	fDeltaLife = -1.0f;	break;
		default:
			ASSERT(0);
		}
		break;
	default:
		ASSERT(0);
	}

	ChangeLife( fDeltaLife );
}
void LifeMeterBar::ChangeLife( TapNoteScore score )
{
	float fDeltaLife=0.f;
	switch( score )
	{
	DEFAULT_FAIL( score );
	case TNS_W1:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W1);	break;
	case TNS_W2:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W2);	break;
	case TNS_W3:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W3);	break;
	case TNS_W4:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W4);	break;
	case TNS_W5:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W5);	break;
	case TNS_Miss:		fDeltaLife = m_fLifePercentChange.GetValue(SE_Miss);	break;
	case TNS_HitMine:	fDeltaLife = m_fLifePercentChange.GetValue(SE_HitMine);	break;
	case TNS_None:		fDeltaLife = m_fLifePercentChange.GetValue(SE_Miss);	break;
	case TNS_CheckpointHit:	fDeltaLife = m_fLifePercentChange.GetValue(SE_CheckpointHit);	break;
	case TNS_CheckpointMiss:fDeltaLife = m_fLifePercentChange.GetValue(SE_CheckpointMiss);	break;
	}

	// this was previously if( IsHot()  &&  score < TNS_GOOD ) in 3.9... -freem
	if( IsHot()  &&  fDeltaLife < 0 )
		fDeltaLife = min( fDeltaLife, -0.10f );		// make it take a while to get back to "hot"

	switch( GAMESTATE->m_SongOptions.GetSong().m_DrainType )
	{
	DEFAULT_FAIL( GAMESTATE->m_SongOptions.GetSong().m_DrainType );
	case SongOptions::DRAIN_NORMAL:
		break;
	case SongOptions::DRAIN_NO_RECOVER:
		fDeltaLife = min( fDeltaLife, 0 );
		break;
	case SongOptions::DRAIN_SUDDEN_DEATH:
		if( score < MIN_STAY_ALIVE )
			fDeltaLife = -1.0f;
		else
			fDeltaLife = 0;
		break;
	}

	ChangeLife( fDeltaLife );
}
Esempio n. 11
0
void LifeMeterBar::ChangeLife( TapNoteScore score )
{
	float fDeltaLife=0.f;
	switch( score )
	{
	DEFAULT_FAIL( score );
	case TNS_W1:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W1);	break;
	case TNS_W2:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W2);	break;
	case TNS_W3:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W3);	break;
	case TNS_W4:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W4);	break;
	case TNS_W5:		fDeltaLife = m_fLifePercentChange.GetValue(SE_W5);	break;
	case TNS_Miss:		fDeltaLife = m_fLifePercentChange.GetValue(SE_Miss);	break;
	case TNS_HitMine:	fDeltaLife = m_fLifePercentChange.GetValue(SE_HitMine);	break;
	case TNS_None:		fDeltaLife = m_fLifePercentChange.GetValue(SE_Miss);	break;
	case TNS_CheckpointHit:	fDeltaLife = m_fLifePercentChange.GetValue(SE_CheckpointHit);	break;
	case TNS_CheckpointMiss:fDeltaLife = m_fLifePercentChange.GetValue(SE_CheckpointMiss);	break;
	}

	// this was previously if( IsHot()  &&  score < TNS_GOOD ) in 3.9... -freem
	if(PREFSMAN->m_HarshHotLifePenalty && IsHot()  &&  fDeltaLife < 0)
		fDeltaLife = min( fDeltaLife, -0.10f );		// make it take a while to get back to "hot"

	switch(m_pPlayerState->m_PlayerOptions.GetSong().m_DrainType)
	{
	DEFAULT_FAIL(m_pPlayerState->m_PlayerOptions.GetSong().m_DrainType);
	case DrainType_Normal:
		break;
	case DrainType_NoRecover:
		fDeltaLife = min( fDeltaLife, 0 );
		break;
	case DrainType_SuddenDeath:
		if( score < MIN_STAY_ALIVE )
			fDeltaLife = -1.0f;
		else
			fDeltaLife = 0;
		break;
	}

	ChangeLife( fDeltaLife );
}
Esempio n. 12
0
void LifeMeterBar::ChangeLifeMine()
{
	float fDeltaLife=0.f;
	switch( GAMESTATE->m_SongOptions.m_DrainType )
	{
	case SongOptions::DRAIN_NORMAL:
		fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeHitMine;
		if( IsHot() )
			fDeltaLife = -0.10f;		// make it take a while to get back to "doing great"
		break;
	case SongOptions::DRAIN_NO_RECOVER:
		fDeltaLife = PREFSMAN->m_fLifeDeltaPercentChangeHitMine;
		break;
	case SongOptions::DRAIN_SUDDEN_DEATH:
		fDeltaLife = -1.0;
		break;
	default:
		ASSERT(0);
	}

	ChangeLife( fDeltaLife );
}
Esempio n. 13
0
void MeaRulerSlider::OnMouseMove(UINT /* nFlags */, CPoint point)
{
    if (m_captured) {
        CRect rcClient;
        GetClientRect(&rcClient);

        if (m_sliderActive) {
            if (m_vertical) {
                if (point.y < rcClient.bottom && point.y > rcClient.top) {
                    m_sliderPos = point.y;
                } else if (point.y <= rcClient.top) {
                    m_sliderPos = rcClient.top + 1;
                } else {
                    m_sliderPos = rcClient.bottom;
                }
            } else {
                if (point.x < rcClient.right && point.x > rcClient.left) {
                    m_sliderPos = point.x;
                } else if (point.x <= rcClient.left) {
                    m_sliderPos = rcClient.left + 1;
                } else {
                    m_sliderPos = rcClient.right;
                }
            }

            Invalidate(TRUE);

            GetParent()->PostMessage(MeaCaliperPositionMsg, m_sliderPos, GetDlgCtrlID());
        }

        TRACE("Left: %d\n", GetSliderPos());
    }

    if (IsHot(m_vertical ? point.y : point.x)) {
        SetCursor(LoadCursor(NULL, m_vertical ? IDC_SIZENS : IDC_SIZEWE));
    }
}
Esempio n. 14
0
void ClsFlatButton::PaintControl( ClsDC *pDC )
{
	// Get the client rectangle.
	ClsRect	rc = GetClientRect();

	// Any room to render in?
	if ( ! rc.IsEmpty())
	{
		// Create an off-screen buffer.
		ClsBufferDC	dc( *pDC, rc );

		// Snapshot the DC.
		int sDC = dc.SaveDC();

		// Render the frame.
		if ( ! m_bXPStyle ) RenderFrame( &dc, rc );
		else
		{
			// Only when were hot or down.
			COLORREF crFg, crBg;
			if (( IsHot() || IsDown()) && IsWindowEnabled())
			{
				crFg = XPColors.GetXPColor( ClsXPColors::XPC_OUTER_SELECTION );
				crBg = XPColors.GetXPColor( IsDown() ? ClsXPColors::XPC_INNER_CHECKED_SELECTED : ClsXPColors::XPC_INNER_SELECTION );
			}
			else
			{
				// Default colors...
				crFg = ( IsDefault() && IsWindowEnabled() && ! m_bXPDefault ) ? XPColors.GetXPColor( ClsXPColors::XPC_OUTER_SELECTION ) : XPColors.GetXPColor( ClsXPColors::XPC_IMAGE_DISABLED );
				crBg = ::GetSysColor( COLOR_BTNFACE );
			}

			// Render rectangle.
			dc.OutlinedRectangle( rc, crFg, crBg );
		}

		// Determine rendering flags.
		DWORD dwFlags = 0;
		if ( ! IsWindowEnabled())			  dwFlags |= ClsDrawTools::CDSF_DISABLED;
		if ( IsDown() && ! ThemingAPI.IsThemingEnabled()) dwFlags |= ClsDrawTools::CDSF_DOWNPRESSED;
		if ( GetUIState() & UISF_HIDEACCEL )		  dwFlags |= ClsDrawTools::CDSF_HIDEACCEL;
		if ( IsHot())					  dwFlags |= ClsDrawTools::CDSF_HOT;

		// Do we have any images?
		if ( m_hImages )
		{
			// Copy the client rectangle.
			ClsRect rcimg( rc );

			// We need to know the size of the images
			// in the image list.
			int cx, cy;
			::ImageList_GetIconSize( m_hImages, &cx, &cy );

			// Determine the place at which we render the images.
			rcimg.Offset( ::GetSystemMetrics( SM_CXFRAME ), 0 );
			rcimg.Right() = rcimg.Left() + cx;

			// Adjust label rectangle.
			rc.Left() += cx + 4;
			
			// Render the image.
			if ( ! m_bXPStyle ) ClsDrawTools::RenderBitmap( dc, m_hImages, ( IsHot() || IsDown()) ? m_aImageIndex[ FIIF_HOT ] : m_aImageIndex[ FIIF_NORMAL ], rcimg, dwFlags );
			else ClsDrawTools::RenderXPBitmap( dc, m_hImages, ( IsHot() || IsDown()) ? m_aImageIndex[ FIIF_HOT ] : m_aImageIndex[ FIIF_NORMAL ], rcimg, dwFlags );
		}

		// Render the caption.
		ClsString str( m_hWnd );

		// Anything to render?
		if ( str.GetStringLength())
		{
			// Deflate the label rectangle.
			rc.Deflate( 3, 3 );

			// Do we have the focus?
			if ( HasFocus() && ! ( GetUIState() & UISF_HIDEFOCUS ) && ! m_bPanelHeader ) dc.DrawFocusRect( rc );

			// Setup the font to use.
			ClsFont font;
			GetFont( font );
			ClsSelector sel( &dc, font );

			// Render transparently.
			dc.SetBkMode( TRANSPARENT );
			
			// We must not use the disabled flag if we are
			// rendering XP style...
			if ( m_bXPStyle ) dwFlags &= ~( ClsDrawTools::CDSF_DISABLED | ClsDrawTools::CDSF_DOWNPRESSED );

			// Set text color.
			COLORREF cr = GetSysColor( IsWindowEnabled() ? COLOR_BTNTEXT : COLOR_GRAYTEXT );
			if ( IsDown() && m_bXPStyle ) cr = XPColors.GetXPColor( ClsXPColors::XPC_TEXT_BACKGROUND );

			if ( IsHot() || IsDown()) cr = m_crHotLabelColor == CLR_NONE ? cr : m_crHotLabelColor;
			else			  cr = m_crLabelColor    == CLR_NONE ? cr : m_crLabelColor;
			dc.SetTextColor( cr );

			// Render the caption.
			ClsDrawTools::RenderText( dc, str, rc, dwFlags );
		}

		// Restore device context.
		dc.RestoreDC( sDC );
	}
}