void ScummEngine::setCameraFollows(Actor *a, bool setCamera) {

	int t, i;

	camera._mode = kFollowActorCameraMode;
	camera._follows = a->_number;

	if (!a->isInCurrentRoom()) {
		startScene(a->getRoom(), 0, 0);
		camera._mode = kFollowActorCameraMode;
		camera._cur.x = a->_pos.x;
		setCameraAt(camera._cur.x, 0);
	}

	t = a->_pos.x / 8 - _screenStartStrip;

	if (t < camera._leftTrigger || t  > camera._rightTrigger || setCamera == true)
		setCameraAt(a->_pos.x, 0);

	for (i = 1; i < _numActors; i++) {
		if (_actors[i].isInCurrentRoom())
			_actors[i]._needRedraw = true;
	}
	runInventoryScript(0);
}
void ScummEngine::setCameraAtEx(int at) {
	if (!(_game.features & GF_NEW_CAMERA)) {
		camera._mode = kNormalCameraMode;
		camera._cur.x = at;
		setCameraAt(at, 0);
		camera._movingToActor = false;
	}
}
Exemple #3
0
void ScummEngine_v0::o_loadRoomWithEgo() {
	Actor_v0 *a;
	int obj, room, x, y, dir;

	obj = fetchScriptByte();
	room = fetchScriptByte();

	a = (Actor_v0 *)derefActor(VAR(VAR_EGO), "o_loadRoomWithEgo");

	//0x634F
	if (a->_miscflags & kActorMiscFlagFreeze) {
		stopObjectCode();
		return;
	}

	// The original interpreter sets the actors new room X/Y to the last rooms X/Y
	// This fixes a problem with MM: script 158 in room 12, the 'Oomph!' script
	// This scripts runs before the actor position is set to the correct room entry location
	a->putActor(a->getPos().x, a->getPos().y, room);
	_egoPositioned = false;

	startScene(a->_room, a, obj);

	getObjectXYPos(obj, x, y, dir);
	AdjustBoxResult r = a->adjustXYToBeInBox(x, y);
	x = r.x;
	y = r.y;
	a->putActor(x, y, _currentRoom);

	camera._dest.x = camera._cur.x = a->getPos().x;
	setCameraAt(a->getPos().x, a->getPos().y);
	setCameraFollows(a);

	_fullRedraw = true;

	resetSentence();

	if (x >= 0 && y >= 0) {
		a->startWalkActor(x, y, -1);
	}
}
void ScummEngine_v7::setCameraFollows(Actor *a, bool setCamera) {

	byte oldfollow = camera._follows;
	int ax, ay;

	camera._follows = a->_number;
	VAR(VAR_CAMERA_FOLLOWED_ACTOR) = a->_number;

	if (!a->isInCurrentRoom()) {
		startScene(a->getRoom(), 0, 0);
	}

	ax = ABS(a->_pos.x - camera._cur.x);
	ay = ABS(a->_pos.y - camera._cur.y);

	if (ax > VAR(VAR_CAMERA_THRESHOLD_X) || ay > VAR(VAR_CAMERA_THRESHOLD_Y) || ax > (_screenWidth / 2) || ay > (_screenHeight / 2)) {
		setCameraAt(a->_pos.x, a->_pos.y);
	}

	if (a->_number != oldfollow)
		runInventoryScript(0);
}