Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
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  //Noise multiplier based on player speed
19  static float GetNoiseMultiplierByPlayerSpeed(DayZPlayerImplement playerImplement)
20  {
22 
23  playerImplement.GetMovementState(hms);
24 
25  if ( playerImplement.GetCommand_Move() && playerImplement.GetCommand_Move().IsInRoll() )
26  {
27  // When rolling we are prone, so we load that Noise value, hence we multiply
28  return PlayerConstants.AI_NOISE_ROLL;
29  }
30 
31  switch ( AITargetCallbacksPlayer.StanceToMovementIdxTranslation(hms) )
32  {
33  case DayZPlayerConstants.MOVEMENTIDX_IDLE:
34  return PlayerConstants.AI_NOISE_IDLE;
35 
36  case DayZPlayerConstants.MOVEMENTIDX_WALK:
37  return PlayerConstants.AI_NOISE_WALK;
38 
39  case DayZPlayerConstants.MOVEMENTIDX_CROUCH_RUN:
40  return PlayerConstants.AI_NOISE_CROUCH_RUN;
41 
42  case DayZPlayerConstants.MOVEMENTIDX_RUN:
43  return PlayerConstants.AI_NOISE_RUN;
44 
45  case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
46  return PlayerConstants.AI_NOISE_SPRINT;
47  }
48 
49  //Default return
50  return PlayerConstants.AI_NOISE_SPRINT;
51  }
52 
53 
54  //Noise multiplier based on type of boots
55  static float GetNoiseMultiplierByShoes(DayZPlayerImplement playerImplement)
56  {
57  switch ( playerImplement.GetBootsType() )
58  {
59  case AnimBootsType.None:
60  return PlayerConstants.AI_NOISE_SHOES_NONE;
61 
62  case AnimBootsType.Sneakers:
63  return PlayerConstants.AI_NOISE_SHOES_SNEAKERS;
64 
65  case AnimBootsType.Boots:
66  return PlayerConstants.AI_NOISE_SHOES_BOOTS;
67  }
68 
69  //Default return
70  return PlayerConstants.AI_NOISE_SHOES_BOOTS;
71  }
72 
73  //Gets noise multiplayer base on surface player walks on
74  static float GetNoiseMultiplierBySurface(DayZPlayerImplement playerImplement)
75  {
76  return playerImplement.GetSurfaceNoise();
77  }
78 }
AnimBootsType
AnimBootsType
Definition: dayzanimevents.c:97
HumanMovementState
Definition: human.c:1125
NoiseAIEvaluate
Definition: sensesaievaluate.c:1
PlayerConstants
Definition: playerconstants.c:1
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
DayZPlayerImplement
Definition: manbase.c:1
AITargetCallbacksPlayer
Definition: aitargetcallbacksplayer.c:1