| 30 | } |
| 31 | |
| 32 | void SpawnDecal(Vector3 pos, int roomNumber, DecalType type) |
| 33 | { |
| 34 | if (!g_Configuration.EnableDecals) |
| 35 | return; |
| 36 | |
| 37 | auto distance = Vector3::Distance(Camera.pos.ToVector3(), pos); |
| 38 | if (type == DecalType::BulletHole && !Lara.Control.Look.IsUsingLasersight && distance > COLLISION_CHECK_DISTANCE) |
| 39 | return; |
| 40 | |
| 41 | auto& decal = GetNewEffect(Decals, Decal::COUNT_MAX); |
| 42 | |
| 43 | auto radius = 1.0f; |
| 44 | auto opacity = 1.0f; |
| 45 | auto life = Decal::LIFE_MAX; |
| 46 | |
| 47 | switch (type) |
| 48 | { |
| 49 | default: |
| 50 | case DecalType::BulletHole: |
| 51 | radius = CLICK(0.2f) * Random::GenerateFloat(0.9f, 1.1f); |
| 52 | opacity = Random::GenerateFloat(0.4f, 0.6f) * Random::GenerateFloat(0.8f, 1.2f); |
| 53 | break; |
| 54 | |
| 55 | case DecalType::Explosion: |
| 56 | radius = CLICK(3.0f) * Random::GenerateFloat(0.7f, 1.3f); |
| 57 | opacity = Random::GenerateFloat(0.9f, 1.0f) * Random::GenerateFloat(0.8f, 1.2f); |
| 58 | life *= 2.0f; |
| 59 | break; |
| 60 | } |
| 61 | |
| 62 | decal.Type = type; |
| 63 | decal.StartOpacity = opacity; |
| 64 | decal.Life = life; |
| 65 | decal.LifeStartFading = Decal::LIFE_START_FADING; |
| 66 | |
| 67 | decal.Sphere.Center = pos; |
| 68 | decal.Sphere.Radius = radius; |
| 69 | decal.RoomNumber = roomNumber; |
| 70 | |
| 71 | decal.UpdateNeighbors(); |
| 72 | } |
| 73 | |
| 74 | void UpdateDecals() |
| 75 | { |
no test coverage detected