Ejemplo n.º 1
0
void C_CFPlayer::PreThink()
{
	FollowMode();

	LatchThink();

	// Recoil
	QAngle viewangles;
	engine->GetViewAngles( viewangles );

	float flYawRecoil;
	float flPitchRecoil;
	GetRecoilToAddThisFrame( flPitchRecoil, flYawRecoil );

	// Recoil
	if( flPitchRecoil > 0 )
	{
		//add the recoil pitch
		viewangles[PITCH] -= flPitchRecoil;
		viewangles[YAW] += flYawRecoil;
	}

	engine->SetViewAngles( viewangles );

	BaseClass::PreThink();

	if (m_afButtonPressed & IN_ALT2)
		Instructor_LessonLearned(HINT_SHIFT_MAGIC);

	CalculateHandMagic();
}
Ejemplo n.º 2
0
NotationSelector::FollowMode
NotationSelector::handleMouseMove(const NotationMouseEvent *e)
{
    if (!m_updateRect) return NoFollow;

//    std::cout << "NotationSelector::handleMouseMove: staff is " 
//              << m_selectedStaff << ", m_updateRect is " << m_updateRect
//              << std::endl;

    if (!m_selectedStaff) m_selectedStaff = e->staff;

    int w = int(e->sceneX - m_selectionRect->x());
    int h = int(e->sceneY - m_selectionRect->y());

    NOTATION_DEBUG << "NotationSelector::handleMouseMove:  w: " << w << " h: " << h << endl;

    if (m_clickedElement /* && !m_clickedElement->isRest() */) {

// Fine (micro-position) drag is BROKEN, and I'm bypassing its mangled corpse.        
//        if (m_startedFineDrag) {
//            dragFine(e->sceneX, e->sceneY, false);
//        } else if (m_clickedShift) {
//            if (w > 2 || w < -2 || h > 2 || h < -2) {
//                dragFine(e->sceneX, e->sceneY, false);
//           }
//        } else 
           
        if ((w > 3 || w < -3 || h > 3 || h < -3) &&
            !m_clickedShift) {
//            std::cout << "Dragging from Code Point Bravo: w: " << w << " h: " << h << std::endl;
            drag(e->sceneX, e->sceneY, false);
        }

    } else {

        // Qt rectangle dimensions appear to be 1-based
        if (w > 0) ++w;
        else --w;
        if (h > 0) ++h;
        else --h;

        QPointF p0(m_selectionOrigin);
        QPointF p1(e->sceneX, e->sceneY);
        QRectF r = QRectF(p0, p1).normalized();

        m_selectionRect->setRect(r.x() + 0.5, r.y() + 0.5, r.width(), r.height());
        m_selectionRect->show();

        setViewCurrentSelection(true);
    }

    return FollowMode(FollowHorizontal | FollowVertical);
}
Ejemplo n.º 3
0
MatrixSelector::FollowMode
MatrixSelector::handleMouseMove(const MatrixMouseEvent *e)
{
    if (m_dispatchTool) {
        return m_dispatchTool->handleMouseMove(e);
    }

    if (!m_updateRect) {
        setContextHelpFor
            (e, getSnapGrid()->getSnapSetting() == SnapGrid::NoSnap);
        return NoFollow;
    } else {
        clearContextHelp();
    }

    QPointF p0(m_selectionOrigin);
    QPointF p1(e->sceneX, e->sceneY);
    QRectF r = QRectF(p0, p1).normalized();

    m_selectionRect->setRect(r.x() + 0.5, r.y() + 0.5, r.width(), r.height());
    m_selectionRect->show();

    setViewCurrentSelection(false);

    

/*
    int w = int(p.x() - m_selectionRect->x());
    int h = int(p.y() - m_selectionRect->y());

    // Qt rectangle dimensions appear to be 1-based
    if (w > 0)
        ++w;
    else
        --w;
    if (h > 0)
        ++h;
    else
        --h;

    // Workaround for #930420 Positional error in sweep-selection box boundary
    int wFix = (w > 0) ? 3 : 0;
    int hFix = (h > 0) ? 3 : 0;
    int xFix = (w < 0) ? 3 : 0;
    m_selectionRect->setSize(w - wFix, h - hFix);
    m_selectionRect->setX(m_selectionRect->x() + xFix);
    setViewCurrentSelection();
    m_selectionRect->setSize(w, h);
    m_selectionRect->setX(m_selectionRect->x() - xFix);
    m_widget->canvas()->update();
*/
    return FollowMode(FollowHorizontal | FollowVertical);
}