示例#1
0
bool Game_Player::GetOffVehicle() {
	if (!InAirship()) {
		int front_x = Game_Map::XwithDirection(GetX(), GetDirection());
		int front_y = Game_Map::YwithDirection(GetY(), GetDirection());
		if (!CanWalk(front_x, front_y))
			return false;
	}

	GetVehicle()->GetOff();
	if (!InAirship()) {
		location.unboarding = true;
		Unboard();
		through = true;
		MoveForward();
		through = false;
	}

	return true;
}
示例#2
0
void Game_Player::UpdateNonMoving(bool last_moving) {
	if (IsMoving() || IsMoveRouteOverwritten()) return;

	if (last_moving && location.boarding) {
		// Boarding completed
		location.aboard = true;
		location.boarding = false;
		SetMoveSpeed(GetVehicle()->GetMoveSpeed());
		SetDirection(GetVehicle()->GetDirection());
		return;
	}

	if (last_moving && location.unboarding) {
		// Unboarding completed
		location.unboarding = false;
		location.vehicle = Game_Vehicle::None;
		CheckTouchEvent();
		return;
	}

	if (InAirship() && !GetVehicle()->IsInUse()) {
		// Airship has landed
		Unboard();
		location.vehicle = Game_Vehicle::None;
		SetDirection(RPG::EventPage::Direction_down);

	}

	if (last_moving && CheckTouchEvent()) return;

	if (!Game_Message::visible && Input::IsTriggered(Input::DECISION)) {
		if ( GetOnOffVehicle() ) return;
		if ( CheckActionEvent() ) return;
	}

	if (last_moving)
		Game_Map::UpdateEncounterSteps();
}
示例#3
0
void Game_Player::Update() {
	int cur_frame_count = Player::GetFrames();
	// Only update the event once per frame
	if (cur_frame_count == frame_count_at_last_update_parallel) {
		return;
	}
	frame_count_at_last_update_parallel = cur_frame_count;

	bool last_moving = IsMoving() || IsJumping();

	// Workaround: If a blocking move route ends in this frame, Game_Player::CancelMoveRoute decides
	// which events to start. was_blocked is used to avoid triggering events the usual way.
	bool was_blocked = IsBlockedByMoveRoute();
	Game_Character::Update();

	if (!Game_Map::GetInterpreter().IsRunning() && !Game_Map::IsAnyEventStarting()) {
		if (IsMovable()) {
			switch (Input::dir4) {
				case 2:
					Move(Down);
					break;
				case 4:
					Move(Left);
					break;
				case 6:
					Move(Right);
					break;
				case 8:
					Move(Up);
			}
		}

		// ESC-Menu calling
		if (Game_System::GetAllowMenu() && !Game_Message::message_waiting && Input::IsTriggered(Input::CANCEL)) {
			Game_Temp::menu_calling = true;
		}
	}

	Game_Character::UpdateSprite();
	UpdateScroll();

	if (location.aboard)
		GetVehicle()->SyncWithPlayer();

	if (IsMoving() || was_blocked) return;

	if (last_moving && location.boarding) {
		// Boarding completed
		location.aboard = true;
		location.boarding = false;
		SetMoveSpeed(GetVehicle()->GetMoveSpeed());
		SetDirection(GetVehicle()->GetDirection());
		return;
	}

	if (last_moving && location.unboarding) {
		// Unboarding completed
		location.unboarding = false;
		location.vehicle = Game_Vehicle::None;
		CheckTouchEvent();
		return;
	}

	if (InAirship() && !GetVehicle()->IsInUse()) {
		// Airship has landed
		Unboard();
		location.vehicle = Game_Vehicle::None;
		SetDirection(RPG::EventPage::Direction_down);

	}

	if (last_moving && CheckTouchEvent()) return;

	if (!Game_Map::GetInterpreter().IsRunning() && !Game_Map::IsAnyEventStarting()) {
		if (!Game_Message::visible && Input::IsTriggered(Input::DECISION)) {
			if ( GetOnOffVehicle() ) return;
			if ( CheckActionEvent() ) return;
		}
	}

	if (last_moving)
		Game_Map::UpdateEncounterSteps();
}