Exemplo n.º 1
0
EVENT GUIProcessControlNotify( EVENT ev, a_dialog *ui_dlg_info, gui_window *wnd )
{
    unsigned    id;

    switch( ev ) {
    case EV_CHECK_BOX_CLICK :
        CheckNotify( ui_dlg_info, wnd );
        return( EV_NO_EVENT );
    case EV_LIST_BOX_DCLICK :
    case EV_LIST_BOX_CHANGED :
    case EV_LIST_BOX_CLOSED :
        ListNotify( ev, ui_dlg_info, wnd );
        return( EV_NO_EVENT );
    case EV_CURSOR_UP :
        EditNotify( GUI_KEY_UP, ui_dlg_info, wnd );
        return( EV_NO_EVENT );
    case EV_CURSOR_DOWN :
        EditNotify( GUI_KEY_DOWN, ui_dlg_info, wnd );
        return( EV_NO_EVENT );
    default :
        if( ev >= GUI_FIRST_USER_EVENT ) {
            id = GETID( ev );
            GUIEVENTWND( wnd, GUI_CONTROL_CLICKED, &id );
            return( EV_NO_EVENT );
        }
        return( ev );
    }
}
Exemplo n.º 2
0
void CScriptMoveType::Update()
{
	if (useRotVel) {
		rot += rotVel;
		CalcDirections();
	}

	owner->speed = vel;
	if (extrapolate) {
		if (drag != 0.0f) {
			vel *= (1.0f - drag); // quadratic drag does not work well here
		}
		if (useRelVel) {
			const float3 rVel = (owner->frontdir *  relVel.z) +
			                    (owner->updir    *  relVel.y) +
			                    (owner->rightdir * -relVel.x); // x is left
			owner->speed += rVel;
		}
		vel.y        += mapInfo->map.gravity * gravityFactor;
		owner->speed += (wind.GetCurrentWind() * windFactor);
		owner->pos   += owner->speed;
	}

	if (trackGround) {
		const float gndMin =
			ground->GetHeight2(owner->pos.x, owner->pos.z) + groundOffset;
		if (owner->pos.y <= gndMin) {
			owner->pos.y = gndMin;
			owner->speed.y = 0.0f;
			if (gndStop) {
				owner->speed.y = 0.0f;
				vel    = ZeroVector;
				relVel = ZeroVector;
				rotVel = ZeroVector;
				scriptNotify = 1;
			}
		}
	}

	// positional clamps
	CheckLimits();

	if (trackSlope) {
		TrackSlope();
	}

	owner->UpdateMidPos();

	// don't need the rest if the pos hasn't changed
	if (oldPos == owner->pos) {
		CheckNotify();
		return;
	}

	oldPos = owner->pos;

	if (!noBlocking) {
		owner->Block();
	}

	if (groundDecals && owner->unitDef->leaveTracks && leaveTracks &&
	    (lastTrackUpdate < (gs->frameNum - 7)) &&
	    ((owner->losStatus[gu->myAllyTeam] & LOS_INLOS) || gu->spectatingFullView)) {
		lastTrackUpdate = gs->frameNum;
		groundDecals->UnitMoved(owner);
	}

	CheckNotify();
};
Exemplo n.º 3
0
bool CScriptMoveType::Update()
{
	if (useRotVel)
		owner->SetDirVectorsEuler(rot += rotVel);

	if (extrapolate) {
		// NOTE: only gravitational acc. is allowed to build up velocity
		// NOTE: strong wind plus low gravity can cause substantial drift
		const float3 gravVec = UpVector * (mapInfo->map.gravity * gravityFactor);
		const float3 windVec =            (wind.GetCurrentWind() * windFactor);
		const float3 unitVec = useRelVel?
			(owner->frontdir *  relVel.z) +
			(owner->updir    *  relVel.y) +
			(owner->rightdir * -relVel.x):
			ZeroVector;

		owner->Move(gravVec + velVec, true);
		owner->Move(windVec,          true);
		owner->Move(unitVec,          true);

		// quadratic drag does not work well here
		velVec += gravVec;
		velVec *= (1.0f - drag);

		owner->SetVelocityAndSpeed(velVec);
	}

	if (trackGround) {
		const float gndMin = CGround::GetHeightReal(owner->pos.x, owner->pos.z) + groundOffset;

		if (owner->pos.y <= gndMin) {
			owner->Move(UpVector * (gndMin - owner->pos.y), true);
			owner->speed.y = 0.0f;

			if (gndStop) {
				velVec = ZeroVector;
				relVel = ZeroVector;
				rotVel = ZeroVector;
				scriptNotify = 1;
			}
		}
	}

	// positional clamps
	CheckLimits();

	if (trackSlope) {
		owner->UpdateDirVectors(true);
		owner->UpdateMidAndAimPos();
	}

	// don't need the rest if the pos hasn't changed
	if (oldPos == owner->pos) {
		CheckNotify();
		return false;
	}

	oldPos = owner->pos;

	if (!noBlocking)
		owner->Block();

	CheckNotify();
	return true;
}
//---------------------------------------------------------------
EditApointmentView::EditApointmentView(BRect frame, const char *name, uint32 resizeMask, uint32 flags,
				 const char* title = "MyApointment", const char* time = "12:00", const char* note = "",
				 bool notify = true)
		: BView(frame, name, resizeMask, flags)
{
//Set it up
SetViewColor(BeBack);

//Construct
mTitleControl = new BTextControl(BRect(5, 5, 240, 35), "mTitleControl", STR_APOINTMENT_NAME[INT_LANGUAGE], "MyScript",
					 new BMessage(MSG_BOGUS), B_FOLLOW_LEFT | B_FOLLOW_TOP);
mTitleControl->SetDivider(90);
mTitleControl->SetText(title);

mHourMenu = new BMenu("mHourMenu");
mHourMenu->SetLabelFromMarked(true);

mMinuteMenu = new BMenu("mMinuteMenu");
mMinuteMenu->SetLabelFromMarked(true); 

mHourMenuField = new BMenuField(BRect(260, 5, 370, 25), "mHourMenuField",  STR_NOTIFY_ME_AT[INT_LANGUAGE],
					mHourMenu,  B_FOLLOW_LEFT | B_FOLLOW_TOP);
mHourMenuField->SetDivider(70);

mMinuteMenuField = new BMenuField(BRect(362, 5, 410, 25), "mMinuteMenuField", ":",
					mMinuteMenu,  B_FOLLOW_LEFT | B_FOLLOW_TOP);
mMinuteMenuField->SetDivider(5);

mTextView = new BTextView(BRect(5, 50, frame.right - (10 + B_V_SCROLL_BAR_WIDTH), frame.bottom - (43 + B_H_SCROLL_BAR_HEIGHT)),
				 "mScriptTextView", BRect(2, 2, frame.right * 3, frame.bottom - 45), B_FOLLOW_ALL_SIDES);
AddChild(mScriptScrollView = new BScrollView("mScriptScrollBar", mTextView, B_FOLLOW_ALL_SIDES, 0, true, true));
mTextView->SetWordWrap(false);
mTextView->SetText(note);
mTextView->MakeEditable(true);
mTextView->MakeSelectable(true);
mTextView->ForceFontAliasing(true);

mNotifyBox = new BCheckBox(BRect(260, 30, 330, 45), "mNotifyBox", STR_NOTIFY_ME[INT_LANGUAGE], new BMessage(MSG_NOTIFY_APOINTMENT_CHECKBOX));
mNotifyBox->SetValue(notify);

mSaveButton = new BButton(BRect(frame.right - 120, frame.bottom - 30, frame.right - 20, frame.bottom - 10), "mSaveButton", STR_SAVE[INT_LANGUAGE], new BMessage(MSG_SAVE_APOINTMENT));
mCancelButton = new BButton(BRect(frame.right - 230, frame.bottom - 30, frame.right - 130, frame.bottom - 10), "mCancelButton", STR_CANCEL[INT_LANGUAGE], new BMessage(MSG_CANCEL));


//Set up and add
tmpString2.SetTo(time);
tmpString2.Remove((tmpString2.FindFirst(":")), tmpString2.CountChars() - (tmpString2.FindFirst(":")));
	for (int a = 1; a <= 23; a++)
	{
	tmpString.SetTo("");
	tmpString << a;
	mHourMenu->AddItem(mMenuItem = new BMenuItem(tmpString.String(), new BMessage(MSG_BOGUS)));
		if (a == atoi(tmpString2.String()))
		{
		mMenuItem->SetMarked(true);
		}
	}
	
tmpString3.SetTo(time);
tmpString3.Remove(0, tmpString2.CountChars() + 1);
	for (int a = 0; a < 60; a++)
	{
	tmpString.SetTo("");
	tmpString << a;
	mMinuteMenu->AddItem(mMenuItem = new BMenuItem(tmpString.String(), new BMessage(MSG_BOGUS)));
		if (a == atoi(tmpString3.String()))
		{
		mMenuItem->SetMarked(true);
		}
	}
	
	
AddChild(mTitleControl);
AddChild(mHourMenuField);
AddChild(mMinuteMenuField);
AddChild(mNotifyBox);
AddChild(mSaveButton);
AddChild(mCancelButton);

CheckNotify();
}