DayZ 1.24
Loading...
Searching...
No Matches
HitDirectionEffectBase Class Reference
Collaboration diagram for HitDirectionEffectBase:
[legend]

Static Protected Member Functions

static void CheckValues ()
 range 0..180, randomized offset of direction to make it less acurate
 
static GetCurrentType ()
 

Static Protected Attributes

 m_Type
 
static float m_DurationMax
 
static float m_BreakPointBase
 
static float m_DistanceAdjust
 range 0..1, a point where the fading starts
 
static int m_RotationOverride
 
static float m_Scatter
 

Private Member Functions

override HitDirectionImagesBase GetImageData ()
 
override void FinalizePositionCalculation ()
 
override void SetIndicatorRotation (float timeslice=-1.0)
 
void HitDirectionEffectBase ()
 
void Init (DayZPlayer player, float hit_direction, float intensity_max)
 Called manually after object spawn.
 
HitDirectionImagesBase GetImageData ()
 
void ~HitDirectionEffectBase ()
 
bool DurationCheck ()
 
void Update (float timeslice)
 
void CalculateArrowPosition (float timeslice=-1.0)
 
void FinalizePositionCalculation ()
 specific handling on individual indicator type
 
void SetIndicatorRotation (float timeslice=-1.0)
 
void SetIndicatorPositon (float timeslice=-1.0)
 
override HitDirectionImagesBase GetImageData ()
 
override void FinalizePositionCalculation ()
 
override void SetIndicatorRotation (float timeslice=-1.0)
 
override HitDirectionImagesBase GetImageData ()
 
override void FinalizePositionCalculation ()
 
override void SetIndicatorRotation (float timeslice=-1.0)
 

Private Attributes

const float DURATION_COEF_MIN = 0.6
 
const float INTENSITY_MIN = 0.6
 
float m_HitDirection
 
float m_Duration
 
float m_BreakPoint
 
float m_TimeActive
 
float m_IntensityMax
 
Widget m_LayoutRoot
 
Widget m_Image
 
DayZPlayer m_Player
 
bool m_Initialized
 
int m_SizeXEnf
 
int m_SizeYEnf
 
float m_PosX
 
float m_PosY
 
float m_PosXScreenEdge
 
float m_PosYScreenEdge
 
float m_AngleRad
 
float m_AngleRadPrev
 
float m_SmoothVel [1]
 
ref HitDirectionImagesBase m_ImageData
 

Static Private Attributes

static bool m_ServerOverrideEnabled
 
static int m_Mode
 
static int m_ID
 
static int m_Color
 

Detailed Description

Definition at line 2 of file HitDirectionArrow.c.

Constructor & Destructor Documentation

◆ HitDirectionEffectBase()

void HitDirectionEffectBase::HitDirectionEffectBase ( )
inlineprivate

Definition at line 32 of file HitDirectionBase.c.

33 {
34 m_Initialized = false;
35 m_PosX = 0.0;
36 m_PosY = 0.0;
37 m_AngleRad = 0.0;
38 m_SmoothVel[0] = 0.0;
39
41 m_ImageData.GetCurrentImageData(m_LayoutRoot, m_Image);
42 }
ref HitDirectionImagesBase m_ImageData
override HitDirectionImagesBase GetImageData()

References GetImageData(), m_AngleRad, m_Image, m_ImageData, m_Initialized, m_LayoutRoot, m_PosX, m_PosY, and m_SmoothVel.

◆ ~HitDirectionEffectBase()

void HitDirectionEffectBase::~HitDirectionEffectBase ( )
inlineprivate

Definition at line 75 of file HitDirectionBase.c.

76 {
77 m_LayoutRoot.Show(false);
78 delete m_LayoutRoot;
79 }

References m_LayoutRoot.

Member Function Documentation

◆ CalculateArrowPosition()

void HitDirectionEffectBase::CalculateArrowPosition ( float timeslice = -1.0)
inlineprivate

Definition at line 117 of file HitDirectionBase.c.

118 {
120
121 float angle_direction = m_Player.GetOrientation()[0];
123 float camera_angle = GetGame().GetCurrentCameraDirection().VectorToAngles()[0];
125
130
131 m_PosX = 0.0;
132 m_PosY = 0.0;
133
135
136 if (m_Initialized && timeslice != -1.0)
137 {
138 float val = m_AngleRadPrev - m_AngleRad + Math.PI;
140 val -= Math.PI;
142 }
144
147
149 }
override void FinalizePositionCalculation()
static float m_DistanceAdjust
range 0..1, a point where the fading starts
Definition EnMath.c:7
proto native CGame GetGame()
static const float PI2
Definition EnMath.c:13
static proto float ModFloat(float x, float y)
Returns the floating-point remainder of x/y rounded towards zero.
static proto float NormalizeAngle(float ang)
Normalizes the angle (0...360)
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float Sin(float angle)
Returns sinus of angle in radians.
static const float DEG2RAD
Definition EnMath.c:17
static proto float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)
Does the CD smoothing function - easy in | easy out / S shaped smoothing.
static const float PI
Definition EnMath.c:12
proto void GetScreenSize(out int x, out int y)

References Math::Clamp(), Math::Cos(), Math::DEG2RAD, FinalizePositionCalculation(), GetGame(), GetScreenSize(), m_AngleRad, m_AngleRadPrev, m_DistanceAdjust, m_HitDirection, m_Initialized, m_Player, m_PosX, m_PosXScreenEdge, m_PosY, m_PosYScreenEdge, m_SizeXEnf, m_SizeYEnf, m_SmoothVel, Math::ModFloat(), Math::NormalizeAngle(), Math::PI, Math::PI2, Math::Sin(), and Math::SmoothCD().

Referenced by Init(), and Update().

◆ CheckValues()

static void HitDirectionEffectBase::CheckValues ( )
inlinestaticprotected

range 0..180, randomized offset of direction to make it less acurate

sets override values, or defaults

Definition at line 175 of file HitDirectionBase.c.

176 {
179 {
186 }
187 else
188 {
189 m_Mode = HitDirectionModes.STATIC;
190 m_ID = HitIndicatorType.SPLASH;
191 m_Color = HitDirectionConstants.COLOR_DEFAULT;
192 m_DurationMax = HitDirectionConstants.DURATION_BASE;
193 m_BreakPointBase = HitDirectionConstants.BREAKPOINT_BASE;
195 }
196 m_DistanceAdjust = HitDirectionConstants.DISTANCE_ADJUST;
197 m_RotationOverride = HitDirectionConstants.ROTATION_DEFAULT;
198 }
static bool GetHitIndicationOverrideEnabled()
static int GetHitIndicationIndicatorColor()
static int GetHitIndicationMode()
static float GetHitIndicationMaxDuration()
static int GetHitIndicationTypeID()
static float GetHitIndicationBreakPoint()
static float GetHitIndicationScatter()
static bool m_ServerOverrideEnabled
HitDirectionModes
Definition constants.c:98

References CfgGameplayHandler::GetHitIndicationBreakPoint(), CfgGameplayHandler::GetHitIndicationIndicatorColor(), CfgGameplayHandler::GetHitIndicationMaxDuration(), CfgGameplayHandler::GetHitIndicationMode(), CfgGameplayHandler::GetHitIndicationOverrideEnabled(), CfgGameplayHandler::GetHitIndicationScatter(), CfgGameplayHandler::GetHitIndicationTypeID(), m_BreakPointBase, m_Color, m_DistanceAdjust, m_DurationMax, m_ID, m_Mode, m_RotationOverride, m_Scatter, and m_ServerOverrideEnabled.

Referenced by PlayerBase::UpdateHitDirectionValues().

◆ DurationCheck()

bool HitDirectionEffectBase::DurationCheck ( )
inlineprivate

Definition at line 81 of file HitDirectionBase.c.

82 {
84 return true;
85 return false;
86 }

References m_Duration, and m_TimeActive.

◆ FinalizePositionCalculation() [1/4]

override void HitDirectionEffectBase::FinalizePositionCalculation ( )
inlineprivate

Definition at line 11 of file HitDirectionArrow.c.

12 {
13 //blobs move around the edges, the rest on elypsis
18 }

References Math::Cos(), and Math::Sin().

Referenced by CalculateArrowPosition().

◆ FinalizePositionCalculation() [2/4]

void HitDirectionEffectBase::FinalizePositionCalculation ( )
inlineprivate

specific handling on individual indicator type

Definition at line 152 of file HitDirectionBase.c.

152{}

◆ FinalizePositionCalculation() [3/4]

override void HitDirectionEffectBase::FinalizePositionCalculation ( )
inlineprivate

Definition at line 11 of file HitDirectionSpike.c.

12 {
13 //blobs move around the edges, the rest on elypsis
18 }

References Math::Cos(), and Math::Sin().

◆ FinalizePositionCalculation() [4/4]

override void HitDirectionEffectBase::FinalizePositionCalculation ( )
inlineprivate

Definition at line 11 of file HitDirectionSplash.c.

12 {
13 //blobs move around the edges, the rest on elypsis
16 }

◆ GetCurrentType()

static HitDirectionEffectBase::GetCurrentType ( )
inlinestaticprotected

Definition at line 200 of file HitDirectionBase.c.

201 {
202 switch (m_ID)
203 {
204 case HitIndicatorType.SPLASH:
206 break;
207
208 case HitIndicatorType.SPIKE:
210 break;
211
212 case HitIndicatorType.ARROW:
214 break;
215
216 default:
217 ErrorEx("Unknown HitDirection mode, using HitIndicatorType.SPLASH", ErrorExSeverity.INFO);
219 break;
220 }
221
222 return m_Type;
223 }
ErrorExSeverity
Definition EnDebug.c:62
enum ShapeType ErrorEx

References ErrorEx, m_ID, and m_Type.

Referenced by Hud::SpawnHitDirEffect().

◆ GetImageData() [1/4]

override HitDirectionImagesBase HitDirectionEffectBase::GetImageData ( )
inlineprivate

Definition at line 4 of file HitDirectionArrow.c.

5 {
6 typename type = HitDirectionImagesArrow;
8 return data;
9 }

Referenced by HitDirectionEffectBase().

◆ GetImageData() [2/4]

HitDirectionImagesBase HitDirectionEffectBase::GetImageData ( )
inlineprivate

Definition at line 73 of file HitDirectionBase.c.

73{}

◆ GetImageData() [3/4]

override HitDirectionImagesBase HitDirectionEffectBase::GetImageData ( )
inlineprivate

Definition at line 4 of file HitDirectionSpike.c.

5 {
6 typename type = HitDirectionImagesSpike;
8 return data;
9 }

◆ GetImageData() [4/4]

override HitDirectionImagesBase HitDirectionEffectBase::GetImageData ( )
inlineprivate

Definition at line 4 of file HitDirectionSplash.c.

5 {
6 typename type = HitDirectionImagesSplash;
8 return data;
9 }

◆ Init()

void HitDirectionEffectBase::Init ( DayZPlayer player,
float hit_direction,
float intensity_max )
inlineprivate

Called manually after object spawn.

Definition at line 45 of file HitDirectionBase.c.

46 {
52 m_Scatter = Math.Clamp(m_Scatter, 0.0, 180.0);
54
56 w = w.GetChildren();
57 while (w)
58 {
59 w.Show(m_Image == w);
60 w = w.GetSibling();
61 }
62
63 m_Image.SetColor(m_Color);
64
65 m_LayoutRoot.Show(true);
66
70 m_Initialized = true;
71 }
void CalculateArrowPosition(float timeslice=-1.0)
void SetIndicatorPositon(float timeslice=-1.0)
override void SetIndicatorRotation(float timeslice=-1.0)
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106
static proto float Pow(float v, float power)
Return power of v ^ power.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54

References CalculateArrowPosition(), Math::Clamp(), DURATION_COEF_MIN, INTENSITY_MIN, m_BreakPoint, m_BreakPointBase, m_Color, m_Duration, m_DurationMax, m_HitDirection, m_Image, m_Initialized, m_IntensityMax, m_LayoutRoot, m_Player, m_Scatter, Math::Pow(), Math::RandomFloatInclusive(), Math::RandomIntInclusive(), SetIndicatorPositon(), and SetIndicatorRotation().

◆ SetIndicatorPositon()

void HitDirectionEffectBase::SetIndicatorPositon ( float timeslice = -1.0)
inlineprivate

Definition at line 155 of file HitDirectionBase.c.

156 {
157 m_LayoutRoot.SetPos(m_PosX, m_PosY, true);
158 }

References m_LayoutRoot, m_PosX, and m_PosY.

Referenced by Init(), and Update().

◆ SetIndicatorRotation() [1/4]

override void HitDirectionEffectBase::SetIndicatorRotation ( float timeslice = -1.0)
inlineprivate

Definition at line 20 of file HitDirectionArrow.c.

21 {
22 if (m_RotationOverride == HitDirectionConstants.ROTATION_DEFAULT)
23 m_LayoutRoot.SetRotation(0, 0, Math.RAD2DEG * m_AngleRad, true);
24 else
25 m_LayoutRoot.SetRotation(0, 0, m_RotationOverride, true);
26 }
static const float RAD2DEG
Definition EnMath.c:16

References Math::RAD2DEG.

Referenced by Init(), and Update().

◆ SetIndicatorRotation() [2/4]

void HitDirectionEffectBase::SetIndicatorRotation ( float timeslice = -1.0)
inlineprivate

Definition at line 153 of file HitDirectionBase.c.

153{}

◆ SetIndicatorRotation() [3/4]

override void HitDirectionEffectBase::SetIndicatorRotation ( float timeslice = -1.0)
inlineprivate

Definition at line 20 of file HitDirectionSpike.c.

21 {
22 if (m_RotationOverride == HitDirectionConstants.ROTATION_DEFAULT)
23 m_LayoutRoot.SetRotation(0, 0, Math.RAD2DEG * m_AngleRad, true);
24 else
25 m_LayoutRoot.SetRotation(0, 0, m_RotationOverride, true);
26 }

References Math::RAD2DEG.

◆ SetIndicatorRotation() [4/4]

override void HitDirectionEffectBase::SetIndicatorRotation ( float timeslice = -1.0)
inlineprivate

Definition at line 18 of file HitDirectionSplash.c.

19 {
20 if (timeslice == -1.0) //does not rotate on dynamic mode update
21 {
22 if (m_RotationOverride == HitDirectionConstants.ROTATION_DEFAULT)
23 m_LayoutRoot.SetRotation(0, 0, Math.RandomIntInclusive(0, 359), true);
24 else
25 m_LayoutRoot.SetRotation(0, 0, m_RotationOverride, true);
26 }
27 }

References Math::RandomIntInclusive().

◆ Update()

void HitDirectionEffectBase::Update ( float timeslice)
inlineprivate

Definition at line 88 of file HitDirectionBase.c.

89 {
90 float intensity;
91
94 else
95 {
98 }
99
101 intensity = Math.Clamp(intensity, 0, 1);
102
104 m_LayoutRoot.Show(false);
105 else
106 {
107 m_LayoutRoot.SetAlpha(intensity);
108 if (m_Mode == HitDirectionModes.DYNAMIC)
109 {
113 }
114 }
115 }
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...

References CalculateArrowPosition(), Math::Clamp(), Math::InverseLerp(), Math::Lerp(), m_BreakPoint, m_Duration, m_IntensityMax, m_LayoutRoot, m_Mode, m_TimeActive, SetIndicatorPositon(), and SetIndicatorRotation().

Member Data Documentation

◆ DURATION_COEF_MIN

const float HitDirectionEffectBase::DURATION_COEF_MIN = 0.6
private

Definition at line 5 of file HitDirectionBase.c.

Referenced by Init().

◆ INTENSITY_MIN

const float HitDirectionEffectBase::INTENSITY_MIN = 0.6
private

Definition at line 6 of file HitDirectionBase.c.

Referenced by Init().

◆ m_AngleRad

float HitDirectionEffectBase::m_AngleRad
private

Definition at line 26 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition(), and HitDirectionEffectBase().

◆ m_AngleRadPrev

float HitDirectionEffectBase::m_AngleRadPrev
private

Definition at line 27 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition().

◆ m_BreakPoint

float HitDirectionEffectBase::m_BreakPoint
private

Definition at line 10 of file HitDirectionBase.c.

Referenced by Init(), and Update().

◆ m_BreakPointBase

float HitDirectionEffectBase::m_BreakPointBase
staticprotected

Definition at line 169 of file HitDirectionBase.c.

Referenced by CheckValues(), and Init().

◆ m_Color

int HitDirectionEffectBase::m_Color
staticprivate

Definition at line 166 of file HitDirectionBase.c.

Referenced by CheckValues(), and Init().

◆ m_DistanceAdjust

float HitDirectionEffectBase::m_DistanceAdjust
staticprotected

range 0..1, a point where the fading starts

Definition at line 170 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition(), and CheckValues().

◆ m_Duration

float HitDirectionEffectBase::m_Duration
private

Definition at line 9 of file HitDirectionBase.c.

Referenced by DurationCheck(), Init(), and Update().

◆ m_DurationMax

float HitDirectionEffectBase::m_DurationMax
staticprotected

Definition at line 168 of file HitDirectionBase.c.

Referenced by CheckValues(), and Init().

◆ m_HitDirection

float HitDirectionEffectBase::m_HitDirection
private

Definition at line 8 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition(), and Init().

◆ m_ID

int HitDirectionEffectBase::m_ID
staticprivate

Definition at line 165 of file HitDirectionBase.c.

Referenced by CheckValues(), and GetCurrentType().

◆ m_Image

Widget HitDirectionEffectBase::m_Image
private

Definition at line 15 of file HitDirectionBase.c.

Referenced by HitDirectionEffectBase(), and Init().

◆ m_ImageData

ref HitDirectionImagesBase HitDirectionEffectBase::m_ImageData
private

Definition at line 30 of file HitDirectionBase.c.

Referenced by HitDirectionEffectBase().

◆ m_Initialized

bool HitDirectionEffectBase::m_Initialized
private

Definition at line 19 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition(), HitDirectionEffectBase(), and Init().

◆ m_IntensityMax

float HitDirectionEffectBase::m_IntensityMax
private

Definition at line 12 of file HitDirectionBase.c.

Referenced by Init(), and Update().

◆ m_LayoutRoot

Widget HitDirectionEffectBase::m_LayoutRoot
private

◆ m_Mode

int HitDirectionEffectBase::m_Mode
staticprivate

Definition at line 164 of file HitDirectionBase.c.

Referenced by CheckValues(), Hud::SpawnHitDirEffect(), and Update().

◆ m_Player

DayZPlayer HitDirectionEffectBase::m_Player
private

Definition at line 17 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition(), and Init().

◆ m_PosX

float HitDirectionEffectBase::m_PosX
private

◆ m_PosXScreenEdge

float HitDirectionEffectBase::m_PosXScreenEdge
private

Definition at line 24 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition().

◆ m_PosY

float HitDirectionEffectBase::m_PosY
private

◆ m_PosYScreenEdge

float HitDirectionEffectBase::m_PosYScreenEdge
private

Definition at line 25 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition().

◆ m_RotationOverride

int HitDirectionEffectBase::m_RotationOverride
staticprotected

Definition at line 171 of file HitDirectionBase.c.

Referenced by CheckValues().

◆ m_Scatter

float HitDirectionEffectBase::m_Scatter
staticprotected

Definition at line 172 of file HitDirectionBase.c.

Referenced by CheckValues(), and Init().

◆ m_ServerOverrideEnabled

bool HitDirectionEffectBase::m_ServerOverrideEnabled
staticprivate

Definition at line 163 of file HitDirectionBase.c.

Referenced by CheckValues().

◆ m_SizeXEnf

int HitDirectionEffectBase::m_SizeXEnf
private

Definition at line 20 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition().

◆ m_SizeYEnf

int HitDirectionEffectBase::m_SizeYEnf
private

Definition at line 21 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition().

◆ m_SmoothVel

float HitDirectionEffectBase::m_SmoothVel[1]
private

Definition at line 28 of file HitDirectionBase.c.

Referenced by CalculateArrowPosition(), and HitDirectionEffectBase().

◆ m_TimeActive

float HitDirectionEffectBase::m_TimeActive
private

Definition at line 11 of file HitDirectionBase.c.

Referenced by DurationCheck(), and Update().

◆ m_Type

HitDirectionEffectBase::m_Type
staticprotected

Definition at line 167 of file HitDirectionBase.c.

Referenced by GetCurrentType().


The documentation for this class was generated from the following files: