DayZ 1.24
Loading...
Searching...
No Matches
Head.c
Go to the documentation of this file.
1class Head_Default extends Head
2{
3 bool m_handling_exception = false;
6
9
11 {
12 Init();
13 }
14
15 void Init()
16 {
17 m_HeadHairHidingStateMap = new map<int, ref SelectionTranslation>;
18 m_HeadHairSelectionArray = new array<string>;
19
20 ConfigGetTextArray("simpleHiddenSelections", m_HeadHairSelectionArray);
21
22 m_beard_idx = m_HeadHairSelectionArray.Find("beard");
23 m_hair_idx = m_HeadHairSelectionArray.Find("hair");
24 if (!ConfigIsExisting("HairHiding"))
25 m_handling_exception = true;
26
28 }
29
31 {
32 for (int i = 0; i < m_HeadHairSelectionArray.Count(); i++)
33 {
35 selTran.SetSelectionState(true);
36 m_HeadHairHidingStateMap.Insert(i, selTran); //all considered "shown" on init
37 }
38 }
39
45
47 {
48 return m_beard_idx;
49 }
50
52 {
53 return m_hair_idx;
54 }
55
57 {
58 return m_HeadHairSelectionArray.Find(str);
59 }
60
62 {
64 }
65};
66
68{
70
72 string m_BasePath;// = "cfgVehicles " + GetType() + " HairHiding";
74 Head_Default m_Head;
75
76 void SelectionTranslation(Head_Default head, int idx)
77 {
78 m_Head = head;
79 m_BasePath = "cfgVehicles " + m_Head.GetType() + " HairHiding";
81 }
82
84 {
85 if (!m_Head.ConfigIsExisting("HairHiding"))
86 return;
87
88 string path;
89 int selectionIdx = -1;
91
92 //Hair
93 path = m_BasePath + " Group_Hair";
95 //Beard
96 path = m_BasePath + " Group_Beard";
98 //Hair + Beard
99 path = m_BasePath + " Group_HairBeard";
101
102 //other
103 for (int i = 0; !m_TranslationFinished; i++)
104 {
105 path = m_BasePath + " Group_" + i;
106 if (g_Game.ConfigIsExisting(path))
108 else
110 }
111 }
112
113 bool SearchAndTranslate(string path, int idx)
114 {
115 if (!g_Game.ConfigIsExisting(path))
116 return false;
117
119 g_Game.ConfigGetTextArray(path + " memberSelections", tempArrayStr);
120 int indexInOriginalArray = -2;
121
122 for (int i = 0; i < tempArrayStr.Count(); i++)
123 {
124 indexInOriginalArray = m_Head.m_HeadHairSelectionArray.Find(tempArrayStr.Get(i));
125 if (idx == indexInOriginalArray) //found it
126 {
127 g_Game.ConfigGetTextArray(path + " simpleSelectionName", tempArrayStr);
128 for (i = 0; i < tempArrayStr.Count(); i++)
129 m_TranslatedSelections.Insert(m_Head.m_HeadHairSelectionArray.Find(tempArrayStr.Get(i)));
131 return true;
132 }
133 }
134 return false;
135 }
136
138 {
140 }
141
143 {
144 return m_SelectionState;
145 }
146
151};
DayZGame g_Game
Definition DayZGame.c:3528
Definition Head.c:2
ref array< string > m_HeadHairSelectionArray
Definition Head.c:8
bool IsHandlingException()
Definition Head.c:61
bool GetHeadHideableSelections(out array< string > selections)
Definition Head.c:40
bool m_handling_exception
Definition Head.c:3
int m_hair_idx
Definition Head.c:5
int GetBeardIndex()
Definition Head.c:46
int GetHairIndex()
Definition Head.c:51
int m_beard_idx
Definition Head.c:4
void InitSelectionTranslation()
Definition Head.c:30
void Init()
Definition Head.c:15
void Head_Default()
Definition Head.c:10
int GetSelectionIndex(string str)
Definition Head.c:56
ref map< int, ref SelectionTranslation > m_HeadHairHidingStateMap
Definition Head.c:7
string m_BasePath
Definition Head.c:72
bool SearchAndTranslate(string path, int idx)
Definition Head.c:113
void InitTranslatedSelections(int idx)
Definition Head.c:83
ref array< int > m_TranslatedSelections
Definition Head.c:73
Head_Default m_Head
Definition Head.c:74
bool m_SelectionState
Definition Head.c:69
void SetSelectionState(bool state)
Definition Head.c:137
ref array< int > GetTranslatedSelections()
Definition Head.c:147
void SelectionTranslation(Head_Default head, int idx)
Definition Head.c:76
bool GetSelectionState()
Definition Head.c:142
bool m_TranslationFinished
Definition Head.c:71