Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
sensesaievaluate.c
Go to the documentation of this file.
2{
3 static float SURFACE_NOISE_WEIGHT = 0.25;
4
5 static float GetNoiseMultiplier(DayZPlayerImplement playerImplement)
6 {
7 float speedNoise = GetNoiseMultiplierByPlayerSpeed(playerImplement);
8 float shoesNoise = GetNoiseMultiplierByShoes(playerImplement);
9 float surfaceNoise = GetNoiseMultiplierBySurface(playerImplement);
10
11 surfaceNoise *= SURFACE_NOISE_WEIGHT;
12 float avgNoise = (shoesNoise + surfaceNoise)/(1 + SURFACE_NOISE_WEIGHT);
13 avgNoise *= speedNoise;
14
15 return avgNoise;
16 }
17
18 static float GetNoiseReduction(Weather weather)
19 {
20 if (weather)
21 return weather.GetNoiseReductionByWeather();
22
23 return 0;
24 }
25
26 //Noise multiplier based on player speed
27 static float GetNoiseMultiplierByPlayerSpeed(DayZPlayerImplement playerImplement)
28 {
29 HumanMovementState hms = new HumanMovementState();
30
31 playerImplement.GetMovementState(hms);
32
33 if ( playerImplement.GetCommand_Move() && playerImplement.GetCommand_Move().IsInRoll() )
34 {
35 // When rolling we are prone, so we load that Noise value, hence we multiply
36 return PlayerConstants.AI_NOISE_ROLL;
37 }
38
39 switch ( AITargetCallbacksPlayer.StanceToMovementIdxTranslation(hms) )
40 {
41 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
42 return PlayerConstants.AI_NOISE_IDLE;
43
44 case DayZPlayerConstants.MOVEMENTIDX_WALK:
45 return PlayerConstants.AI_NOISE_WALK;
46
47 case DayZPlayerConstants.MOVEMENTIDX_CROUCH_RUN:
48 return PlayerConstants.AI_NOISE_CROUCH_RUN;
49
50 case DayZPlayerConstants.MOVEMENTIDX_RUN:
51 return PlayerConstants.AI_NOISE_RUN;
52
53 case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
54 return PlayerConstants.AI_NOISE_SPRINT;
55 }
56
57 //Default return
58 return PlayerConstants.AI_NOISE_SPRINT;
59 }
60
61
62 //Noise multiplier based on type of boots
63 static float GetNoiseMultiplierByShoes(DayZPlayerImplement playerImplement)
64 {
65 switch ( playerImplement.GetBootsType() )
66 {
67 case AnimBootsType.None:
68 return PlayerConstants.AI_NOISE_SHOES_NONE;
69
70 case AnimBootsType.Sneakers:
71 return PlayerConstants.AI_NOISE_SHOES_SNEAKERS;
72
73 case AnimBootsType.Boots:
74 return PlayerConstants.AI_NOISE_SHOES_BOOTS;
75 }
76
77 //Default return
78 return PlayerConstants.AI_NOISE_SHOES_BOOTS;
79 }
80
81 //Gets noise multiplayer base on surface player walks on
82 static float GetNoiseMultiplierBySurface(DayZPlayerImplement playerImplement)
83 {
84 return playerImplement.GetSurfaceNoise();
85 }
86}
AnimBootsType
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602