Example #1
0
bool Game_Player::GetOffVehicle() {
	if (InAirship()) {
		if (!AirshipLandOk(x, y))
			return false;
	}
	else {
		int front_x = Game_Map::XwithDirection(x, direction);
		int front_y = Game_Map::YwithDirection(y, direction);
		if (!CanWalk(front_x, front_y))
			return false;
	}

	Game_Map::GetVehicle((Game_Vehicle::Type) vehicle_type)->GetOff();
	if (InAirship())
		direction = RPG::EventPage::Direction_down;
	else {
		// TODO
		// ForceMoveForward();
		opacity = 255;
	}

    vehicle_getting_off = true;
    move_speed = 4;
    through = false;
	Game_System::BgmPlay(walking_bgm);

	return true;
}
Example #2
0
bool Game_Player::CheckTouchEvent() {
	if (InAirship())
		return false;
	int triggers[] = { RPG::EventPage::Trigger_touched, RPG::EventPage::Trigger_collision };
	std::vector<int> v_triggers( triggers, triggers + sizeof(triggers) / sizeof(int) );
	return CheckEventTriggerHere(v_triggers);
}
Example #3
0
bool Game_Player::CheckTouchEvent() {
	if (InAirship())
		return false;

	if (IsMoveRouteOverwritten())
		return false;

	return CheckEventTriggerHere({RPG::EventPage::Trigger_touched});
}
Example #4
0
bool Game_Player::CheckActionEvent() {
	if (InAirship())
		return false;

	// Use | instead of || to avoid short-circuit evaluation
	return CheckEventTriggerHere({RPG::EventPage::Trigger_action}, true)
		| CheckEventTriggerThere({RPG::EventPage::Trigger_action,
		RPG::EventPage::Trigger_touched, RPG::EventPage::Trigger_collision}, true);
}
Example #5
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;
}
Example #6
0
bool Game_Player::IsMovable() const {
	if (IsMoving() || IsJumping())
		return false;
	if (IsMoveRouteOverwritten())
		return false;
	if (location.boarding || location.unboarding)
		return false;
	if (Game_Message::message_waiting)
		return false;
	if (InAirship() && !GetVehicle()->IsMovable())
		return false;
    return true;
}
Example #7
0
bool Game_Player::IsMovable() const {
	if (IsMoving())
		return false;
	if (GetMoveRouteForcing())
		return false;
	if (vehicle_getting_on)
		return false;
	if (vehicle_getting_off)
		return false;
	if (Game_Message::visible)
		return false;
	if (InAirship() && !Game_Map::GetVehicle(Game_Vehicle::Airship)->IsMovable())
		return false;
    return true;
}
Example #8
0
bool Game_Player::CheckActionEvent() {
	if (InAirship())
		return false;
	int triggers_here[] = { 0 };
	std::vector<int> triggers(triggers_here, triggers_here + sizeof triggers_here / sizeof(int));

	if ( CheckEventTriggerHere(triggers) ) {
		return true;
	}

	int triggers_there[] = { 0, 1, 2 };
	triggers.assign(triggers_there, triggers_there + sizeof triggers_there / sizeof(int));

	return CheckEventTriggerThere(triggers);

}
Example #9
0
bool Game_Player::IsMovable() const {
	if (IsMoving() || IsJumping())
		return false;
	if (Graphics::IsTransitionPending())
		return false;
	if (IsBlockedByMoveRoute())
		return false;
	if (Game_Map::IsAnyEventStarting())
		return false;
	if (location.boarding || location.unboarding)
		return false;
	if (Game_Message::message_waiting)
		return false;
	if (InAirship() && !GetVehicle()->IsMovable())
		return false;
    return true;
}
Example #10
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();
}
Example #11
0
bool Game_Player::IsStopping() const {
	// Prevent MoveRoute execution while the airship is ascending/descending (Issue #1268)
	if (InAirship() && !GetVehicle()->IsMovable())
		return false;
	return Game_Character::IsStopping();
}
Example #12
0
bool Game_Player::CheckCollisionEvent() {
	if (InAirship())
		return false;
	return CheckEventTriggerHere({RPG::EventPage::Trigger_collision});
}
Example #13
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();
}