Ejemplo n.º 1
0
bool WheelBase::MoveSpecific( int n )
{
    /* If we're not selecting, discard this.  We won't ignore it; we'll
     * get called again every time the key is repeated. */
    /* Still process Move(0) so we sometimes continue moving immediate
     * after the sort change finished and before the repeat event causes a
     * Move(0). -Chris */
    switch( m_WheelState )
    {
    case STATE_SELECTING:
        break;
    case STATE_FLYING_OFF_BEFORE_NEXT_SORT:
    case STATE_FLYING_ON_AFTER_NEXT_SORT:
        if( n!= 0 )
            return false;
        break;
    default:
        return false;	// don't continue
    }

    if( m_Moving != 0 && n == 0 && m_TimeBeforeMovingBegins == 0 )
    {
        /* We were moving, and now we're stopping.  If we're really close to
         * the selection, move to the next one, so we have a chance to spin down
         * smoothly. */
        if(fabsf(m_fPositionOffsetFromSelection) < 0.25f )
            ChangeMusic(m_Moving);

        /* Make sure the user always gets an SM_SongChanged when
         * Moving() is 0, so the final banner, etc. always gets set. */
        SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 );
    }

    return true;
}
Ejemplo n.º 2
0
void WheelBase::Move(int n)
{
    if( n == m_Moving )
        return;

    if( m_WheelState == STATE_LOCKED )
    {
        if(n)
        {
            int iSign = n/abs(n);
            m_fLockedWheelVelocity = iSign*LOCKED_INITIAL_VELOCITY;
            m_soundLocked.Play();
        }
        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);
}
Ejemplo n.º 3
0
void WheelBase::ChangeMusicUnlessLocked( int n )
{
    if( m_WheelState == STATE_LOCKED )
    {
        if(n)
        {
            int iSign = n/abs(n);
            m_fLockedWheelVelocity = iSign*LOCKED_INITIAL_VELOCITY;
            m_soundLocked.Play();
        }
        return;
    }

    ChangeMusic( n );
}
Ejemplo n.º 4
0
void Scene_Play::Update(Game* _game)
{	
	Player::Instance()->Update();
	m_hiphop1.Update();
	m_hiphop2.Update();
	m_hiphop3.Update();
	m_razer.update(500);
	m_leftHand.Update();
	m_rightHand.Update();
	
	DecreaseHpGage();
	StageStart();
	ChangeMusic();
	UI_Music_Check();
	Effect();

	if (m_screenDoor.GetCurrentFrame() != m_screenDoor.GetFrame())
	{
		m_screenDoor.update(200);
	}

	CreateZombie();

	for (int index = 0; index < m_currentZombie; ++index)
	{
		if (m_pzombie[index] == NULL)
			continue;

		m_pzombie[index]->Update();

		if (m_pzombie[index]->IsDeath())
		{
			_game->AddScore(m_pzombie[index]->GetScore());
			SAFE_DELETE(m_pzombie[index]);
			--m_currentZombie;
			++m_nKillZombie;
		}
	}

	_game->AddScore(m_currentStage);

	if (Player::Instance()->GetDeath())
		_game->ChangeScene(new Scene_Score());
	
}
Ejemplo n.º 5
0
void WheelBase::Update( float fDeltaTime )
{
    ActorFrame::Update( fDeltaTime );

    /* If tweens aren't controlling the position of the wheel, set positions. */
    if( !GetTweenTimeLeft() )
        SetPositions();

    for( int i=0; i<NUM_WHEEL_ITEMS; i++ )
    {
        WheelItemBase *pDisplay = m_WheelBaseItems[i];
        if( m_WheelState == STATE_LOCKED  &&  i != NUM_WHEEL_ITEMS/2 )
            pDisplay->m_colorLocked = WHEEL_ITEM_LOCKED_COLOR.GetValue();
        else
            pDisplay->m_colorLocked = RageColor(0,0,0,0);
    }

    //Moved to CommonUpdateProcedure, seems to work fine
    //Revert if it happens to break something
    UpdateScrollbar();

    if( m_Moving )
    {
        m_TimeBeforeMovingBegins -= fDeltaTime;
        m_TimeBeforeMovingBegins = max(m_TimeBeforeMovingBegins, 0);
    }

    // update wheel state
    m_fTimeLeftInState -= fDeltaTime;
    if( m_fTimeLeftInState <= 0 )	// time to go to a new state
        UpdateSwitch();

    if( m_WheelState == STATE_LOCKED )
    {
        /* Do this in at most .1 sec chunks, so we don't get weird if we
         * stop for some reason (and so it behaves the same when being
         * single stepped). */
        float fTime = fDeltaTime;
        while( fTime > 0 )
        {
            float t = min( fTime, 0.1f );
            fTime -= t;

            m_fPositionOffsetFromSelection = clamp( m_fPositionOffsetFromSelection, -0.3f, +0.3f );

            float fSpringForce = - m_fPositionOffsetFromSelection * LOCKED_INITIAL_VELOCITY;
            m_fLockedWheelVelocity += fSpringForce;

            float fDrag = -m_fLockedWheelVelocity * t*4;
            m_fLockedWheelVelocity += fDrag;

            m_fPositionOffsetFromSelection  += m_fLockedWheelVelocity*t;

            if( fabsf(m_fPositionOffsetFromSelection) < 0.01f  &&  fabsf(m_fLockedWheelVelocity) < 0.01f )
            {
                m_fPositionOffsetFromSelection = 0;
                m_fLockedWheelVelocity = 0;
            }
        }
    }

    if( IsMoving() )
    {
        /* We're automatically moving.  Move linearly, and don't clamp
         * to the selection. */
        float fSpinSpeed = m_SpinSpeed*m_Moving;
        m_fPositionOffsetFromSelection -= fSpinSpeed*fDeltaTime;

        /* Make sure that we don't go further than 1 away, in case the
         * speed is very high or we miss a lot of frames. */
        m_fPositionOffsetFromSelection  = clamp(m_fPositionOffsetFromSelection, -1.0f, 1.0f);

        /* If it passed the selection, move again. */
        if((m_Moving == -1 && m_fPositionOffsetFromSelection >= 0) ||
                (m_Moving == 1 && m_fPositionOffsetFromSelection <= 0))
        {
            ChangeMusic( m_Moving );

            if( PREFSMAN->m_iMusicWheelSwitchSpeed < MAX_WHEEL_SOUND_SPEED )
                m_soundChangeMusic.Play();
        }

        if( PREFSMAN->m_iMusicWheelSwitchSpeed >= MAX_WHEEL_SOUND_SPEED &&
                m_MovingSoundTimer.PeekDeltaTime() >= 1.0f / MAX_WHEEL_SOUND_SPEED )
        {
            m_MovingSoundTimer.GetDeltaTime();
            m_soundChangeMusic.Play();
        }
    }
    else
    {
        // "rotate" wheel toward selected song
        float fSpinSpeed = 0.2f + fabsf( m_fPositionOffsetFromSelection ) / SWITCH_SECONDS;

        if( m_fPositionOffsetFromSelection > 0 )
        {
            m_fPositionOffsetFromSelection -= fSpinSpeed*fDeltaTime;
            if( m_fPositionOffsetFromSelection < 0 )
                m_fPositionOffsetFromSelection = 0;
        }
        else if( m_fPositionOffsetFromSelection < 0 )
        {
            m_fPositionOffsetFromSelection += fSpinSpeed*fDeltaTime;
            if( m_fPositionOffsetFromSelection > 0 )
                m_fPositionOffsetFromSelection = 0;
        }
    }
}