Пример #1
0
void CCameraMover::updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
	if (_speed > 0.0) {
		pos._x += orientation._row3._x * _speed;
		pos._y += orientation._row3._y * _speed;
		pos._z += orientation._row3._z * _speed;

		errorCode.set();
	}
}
Пример #2
0
MoverState CMarkedAutoMover::move(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
	if (!_active)
		return NOT_ACTIVE;

	_transitionPercent += _transitionPercentInc;
	orientation = _orientationChanger.getOrientation(_transitionPercent);
	errorCode.set();

	if (_field40 >= 0) {
		double speedVal = _speeds[_field40];
		pos += _posDelta * speedVal;
		getVectorOnPath(pos);

		--_field40;
		errorCode.set();
		return MOVING;
	} else if (_field44 > 0) {
		pos += _posDelta * _field38;
		getVectorOnPath(pos);

		--_field44;
		errorCode.set();
		return MOVING;
	} else if (_field48 >= 0) {
		double speedVal = _speeds[nMoverTransitions - 1 - _field48];
		pos += _posDelta * speedVal;
		getVectorOnPath(pos);

		--_field48;
		errorCode.set();
		return MOVING;
	} else {
		_active = false;
		return DONE_MOVING;
	}
}
Пример #3
0
int CStarControlSub24::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
	FVector v1, v2, v3, v4;

	if (!_active)
		return 0;

	// Firstly we have to do a transition of the camera orientation from
	// it's current position to one where the destination star is centered
	if (_transitionPercent < 1.0) {
		_transitionPercent += _transitionPercentInc;
		orientation = _orientationChanger.getOrientation(_transitionPercent);
		errorCode.set();
		return 1;
	}

	// From here on, we handle the movement to the given destination
	if (!_field34) {
		_active = false;
		return 2;
	}

	v2 = orientation._row3;
	v3 = _destPos - pos;
	v3.normalize();

	double val = orientation._row3._x * v3._x + orientation._row3._y * v3._y + orientation._row3._z * v3._z;
	bool flag = false;
	if (val < 1.0) {
		if (val >= 1.0 - 1.0e-10)
			flag = true;
	} else {
		if (val <= 1.0 + 1.0e-10)
			flag = true;
	}

	if (!flag) {
		v1 = v2.addAndNormalize(v3);
		v1 = v2.addAndNormalize(v1);
		v1 = v2.addAndNormalize(v1);
		v1 = v2.addAndNormalize(v1);

		orientation.set(v1);
		v2 = v1;
	}

	if (_field40 >= 0) {
		double speedVal = _speeds[_field40];
		v1 = v2 * speedVal;
		pos += v1;

		--_field40;
		errorCode.set();
		return 1;
	}

	if (_field44 > 0) {
		v1._z = v2._z * _field38;
		v1._x = v2._x * _field38;
		pos._x = v1._x + pos._x;
		pos._y = v2._y * _field38 + pos._y;
		pos._z = v1._z + pos._z;

		--_field44;
		errorCode.set();
		return 1;
	}

	if (_field48 >= 0) {
		double speedVal = _speeds[31 - _field48];
		v1._y = v2._y * speedVal;
		v1._z = v2._z * speedVal;
		v1._x = v2._x * speedVal;
		pos._y = v1._y + pos._y;
		pos._z = v1._z + pos._z;
		pos._x = pos._x + v1._x;

		--_field48;
		errorCode.set();
		return 1;
	}

	_active = false;
	return 2;
}