Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_DestructionData.c
Go to the documentation of this file.
2{
3 float m_fHitDamage;
4 EDamageType m_eDamageType;
5 vector m_vHitPosition;
6 vector m_vHitDirection; //Normalized
7 vector m_vHitNormal; //Normalized
8 bool m_bTotalDestruction;
9 int m_iPreviousPhase;
10
11 const int MAX_PHASES_BIT_SIZE = 4; // Max 16 phases are supported now = 4 bits
12
13 //------------------------------------------------------------------------------------------------
17 void SaveNormalizedVector(ScriptBitWriter w, vector norm)
18 {
19 w.WriteHalf(norm[0]);
20 w.WriteHalf(norm[1]);
21 w.WriteHalf(norm[2]);
22 }
23
24 //------------------------------------------------------------------------------------------------
28 void LoadNormalizedVector(ScriptBitReader r, out vector norm)
29 {
30 float x;
31 float y;
32 float z;
33
34 r.ReadHalf(x);
35 r.ReadHalf(y);
36 r.ReadHalf(z);
37
38 norm = {x,y,z};
39 }
40
41 //------------------------------------------------------------------------------------------------
45 bool Save(ScriptBitWriter w)
46 {
47 SaveNormalizedVector(w, m_vHitDirection);
48 w.WriteFloat(m_fHitDamage);
49 SaveNormalizedVector(w, m_vHitNormal);
50 w.WriteInt(m_eDamageType);
51
52 w.WriteVector(m_vHitPosition); // Maybe we should make this relative to the entity, so it's smaller numbers and we can also write it as half
53 w.WriteBool(m_bTotalDestruction);
54 w.WriteInt(m_iPreviousPhase);
55
56 return true;
57 }
58
59 //------------------------------------------------------------------------------------------------
63 bool Load(ScriptBitReader r)
64 {
65 LoadNormalizedVector(r, m_vHitDirection);
66 r.ReadFloat(m_fHitDamage);
67 LoadNormalizedVector(r, m_vHitNormal);
68 r.ReadInt(m_eDamageType);
69 r.ReadVector(m_vHitPosition);
70 r.ReadBool(m_bTotalDestruction);
71 r.ReadInt(m_iPreviousPhase);
72
73 return true;
74 }
75}
void Load()
Definition gameLib.c:220
EDamageType
Definition EDamageType.c:13