DayZ 1.24
Loading...
Searching...
No Matches
TimeAccel.c
Go to the documentation of this file.
1#ifdef DIAG_DEVELOPER
2typedef Param3<bool, float, int> TimeAccelParam;//enabled, timeAccel,category mask
3
5{
6 //DO NOT FORGET TO INCLUDE IN THE MAPPING 'Init()' FUNCTION
7 UNDERGROUND_ENTRANCE = 0x00000001,
8 UNDERGROUND_RESERVOIR = 0x00000002,
9 ENERGY_CONSUMPTION = 0x00000004,
10 ENERGY_RECHARGE = 0x00000008,
11 FOOD_DECAY = 0x00000010,
12 //SYSTEM5 = 0x00000020,
13 //SYSTEM6 = 0x00000040,
14 //SYSTEM6 = 0x00000080,
15}
16
18{
19 static ref TimeAccelParam m_CurrentTimeAccel;// = new TimeAccelParam(false, 0, 0);
21 static ref array<int> m_IDs = new array<int>();
22 static bool m_Initializeded = Init();
23
24 static bool Init()
25 {
26 Bind(DiagMenuIDs.FEATURE_TIME_ACCEL_UG_ENTRANCES, ETimeAccelCategories.UNDERGROUND_ENTRANCE);
27 Bind(DiagMenuIDs.FEATURE_TIME_ACCEL_UG_RESERVOIR, ETimeAccelCategories.UNDERGROUND_RESERVOIR);
28 Bind(DiagMenuIDs.FEATURE_TIME_ACCEL_ENERGY_CONSUME, ETimeAccelCategories.ENERGY_CONSUMPTION);
29 Bind(DiagMenuIDs.FEATURE_TIME_ACCEL_ENERGY_RECHARGE, ETimeAccelCategories.ENERGY_RECHARGE);
30 Bind(DiagMenuIDs.FEATURE_TIME_ACCEL_FOOD_DECAY, ETimeAccelCategories.FOOD_DECAY);
31 return true;
32 }
33
34 //-------------------------------
35
37 {
38 m_Mapping.Insert(id, catBit);
39 m_IDs.Insert(id);
40 }
41
42 //-------------------------------
43
44 static int GetCategoryByDiagID(DiagMenuIDs id)
45 {
46 return m_Mapping.Get(id);
47 }
48
49 //-------------------------------
50
52 {
53 for (int i = 0; i < m_Mapping.Count(); i++)
54 {
55 if (m_Mapping.GetElement(i) == category)
56 return m_Mapping.GetKey(i);
57 }
58 return -1;
59 }
60
61 //-------------------------------
62
64 {
65 return (m_CurrentTimeAccel && m_CurrentTimeAccel.param1 && (categoryBit & m_CurrentTimeAccel.param3) != 0);
66 }
67
68 //-------------------------------
69
70 static float GetFeatureTimeAccelValue()
71 {
73 return m_CurrentTimeAccel.param2;
74 else return 1;
75 }
76
77 //-------------------------------
78
79 static void CopyTimeAccelClipboard(bool enable, int timeAccelBig, float timeAccelSmall, int bitMask)
80 {
81 string output = "-timeAccel=";
82 int val = enable;
83 output += val.ToString() + "," + timeAccelBig.ToString() + "," + timeAccelSmall.ToString() + "," + bitMask.ToString();
84 GetGame().CopyToClipboard(output);
85 }
86
87 //-------------------------------
88
89 static int GetTimeAccelBitmask()
90 {
91 int bitmask = 0;
92
93 foreach (int id : m_IDs)
95
96 return bitmask;
97 }
98
99 //-------------------------------
100
101 static void WriteCategoryBit(out int bitmask, int diagMenuID)
102 {
105 bitmask = bitmask | bit;
106 }
107
108 //-------------------------------
109
111 {
112 if (!p1 || !p2)
113 return false;
114 if (p1.param1 != p2.param1)
115 return false;
116 if (p1.param2 != p2.param2)
117 return false;
118 if (p1.param3 != p2.param3)
119 return false;
120 return true;
121 }
122
123 //-------------------------------
124
125 static void SendTimeAccel(Man player, TimeAccelParam param)
126 {
127 GetGame().RPCSingleParam(player, ERPCs.DIAG_TIMEACCEL, param, true, player.GetIdentity());
128 }
129}
130#endif
const string Bind
override Widget Init()
Definition DayZGame.c:120
DiagMenuIDs
Definition EDiagMenuIDs.c:2
ERPCs
Definition ERPCs.c:2
proto native CGame GetGame()
static proto int GetValue(int id)
Get value as int from the given script id.