void AAmethystCharacter::UpdatePawnMeshes() { bool const bFirstPerson = IsFirstPerson(); Mesh1P->MeshComponentUpdateFlag = !bFirstPerson ? EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered : EMeshComponentUpdateFlag::AlwaysTickPoseAndRefreshBones; Mesh1P->SetOwnerNoSee(!bFirstPerson); Mesh->MeshComponentUpdateFlag = bFirstPerson ? EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered : EMeshComponentUpdateFlag::AlwaysTickPoseAndRefreshBones; Mesh->SetOwnerNoSee(bFirstPerson); }
void ANimModCharacter::UpdatePawnMeshes() { bool const bFirstPerson = IsFirstPerson(); if (Mesh1P != nullptr) { Mesh1P->MeshComponentUpdateFlag = !bFirstPerson ? EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered : EMeshComponentUpdateFlag::AlwaysTickPoseAndRefreshBones; Mesh1P->SetOwnerNoSee(!bFirstPerson); } GetMesh()->MeshComponentUpdateFlag = bFirstPerson ? EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered : EMeshComponentUpdateFlag::AlwaysTickPoseAndRefreshBones; GetMesh()->SetOwnerNoSee(bFirstPerson); }
void Client::AddBulletTracer(spades::client::Player *player, spades::Vector3 muzzlePos, spades::Vector3 hitPos) { SPADES_MARK_FUNCTION(); // Do not display tracers for bullets fired by the local player if (IsFirstPerson(GetCameraMode()) && GetCameraTargetPlayerId() == player->GetId()) { return; } float vel; switch (player->GetWeapon()->GetWeaponType()) { case RIFLE_WEAPON: vel = 700.f; break; case SMG_WEAPON: vel = 360.f; break; case SHOTGUN_WEAPON: vel = 500.f; break; } AddLocalEntity(new Tracer(this, muzzlePos, hitPos, vel)); AddLocalEntity(new MapViewTracer(muzzlePos, hitPos, vel)); }
USkeletalMeshComponent* ANimModCharacter::GetPawnMesh() const { return IsFirstPerson() ? Mesh1P : GetMesh(); }
USkeletalMeshComponent* AAmethystCharacter::GetPawnMesh() const { return IsFirstPerson() ? Mesh1P : Mesh; }
void Client::BulletHitPlayer(spades::client::Player *hurtPlayer, HitType type, spades::Vector3 hitPos, spades::client::Player *by) { SPADES_MARK_FUNCTION(); SPAssert(type != HitTypeBlock); // don't bleed local player if (!IsFirstPerson(GetCameraMode()) || &GetCameraTargetPlayer() != hurtPlayer) { Bleed(hitPos); } if (hurtPlayer == world->GetLocalPlayer()) { // don't player hit sound now; // local bullet impact sound is // played by checking the decrease of HP return; } if (!IsMuted()) { if (type == HitTypeMelee) { Handle<IAudioChunk> c = audioDevice->RegisterSound("Sounds/Weapons/Spade/HitPlayer.opus"); audioDevice->Play(c, hitPos, AudioParam()); } else { Handle<IAudioChunk> c; switch (SampleRandomInt(0, 2)) { case 0: c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Flesh1.opus"); break; case 1: c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Flesh2.opus"); break; case 2: c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Flesh3.opus"); break; } AudioParam param; param.volume = 4.f; audioDevice->Play(c, hitPos, param); } } if (by == world->GetLocalPlayer() && hurtPlayer) { net->SendHit(hurtPlayer->GetId(), type); if (type == HitTypeHead) { Handle<IAudioChunk> c = audioDevice->RegisterSound("Sounds/Feedback/HeadshotFeedback.opus"); AudioParam param; param.volume = cg_hitFeedbackSoundGain; audioDevice->PlayLocal(c, param); } hitFeedbackIconState = 1.f; if (hurtPlayer->GetTeamId() == world->GetLocalPlayer()->GetTeamId()) { hitFeedbackFriendly = true; } else { hitFeedbackFriendly = false; } } }