-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtime.d
168 lines (138 loc) · 4.51 KB
/
time.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
* Engine function that returns time using oCWorldTimer
*/
func void oCWorldTimer_GetTime (var int hourPtr, var int minPtr) {
//0x006D7BB0 public: void __thiscall oCWorldTimer::GetTime(int &,int &)
const int oCWorldTimer__GetTime_G1 = 7175088;
//0x00780DF0 public: void __thiscall oCWorldTimer::GetTime(int &,int &)
const int oCWorldTimer__GetTime_G2 = 7867888;
var int wldTimerPtr; wldTimerPtr = MEM_Game.wldTimer;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (minPtr));
CALL_PtrParam (_@ (hourPtr));
CALL__thiscall (_@ (wldTimerPtr), MEMINT_SwitchG1G2 (oCWorldTimer__GetTime_G1, oCWorldTimer__GetTime_G2));
call = CALL_End();
};
};
/*
* Engine function that sets up time
*/
func void oCWorldTimer_SetTime (var int hourPtr, var int minPtr) {
//0x006D7C00 public: void __thiscall oCWorldTimer::SetTime(int,int)
const int oCWorldTimer__SetTime_G1 = 7175168;
//0x00780E40 public: void __thiscall oCWorldTimer::SetTime(int,int)
const int oCWorldTimer__SetTime_G2 = 7867968;
var int wldTimerPtr; wldTimerPtr = MEM_Game.wldTimer;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam (_@ (minPtr));
CALL_PtrParam (_@ (hourPtr));
CALL__thiscall (_@ (wldTimerPtr), MEMINT_SwitchG1G2 (oCWorldTimer__SetTime_G1, oCWorldTimer__SetTime_G2));
call = CALL_End();
};
};
/*
* Engine function that returns current world time from zCSkyControler_Outdoor
*/
func int zCSkyControler_Outdoor_GetTime () {
//0x005BC7A0 public: virtual float __thiscall zCSkyControler_Outdoor::GetTime(void)const
const int zCSkyControler_Outdoor__GetTime_G1 = 6014880;
//0x005E66F0 public: virtual float __thiscall zCSkyControler_Outdoor::GetTime(void)const
const int zCSkyControler_Outdoor__GetTime_G2 = 6186736;
if (!MEM_World.skyControlerOutdoor) { return FLOATNULL; };
var int retVal;
const int call = 0;
if (CALL_Begin (call)) {
CALL_RetValIsFloat ();
CALL_PutRetValTo(_@ (retVal));
CALL__thiscall (_@ (MEM_World.skyControlerOutdoor), MEMINT_SwitchG1G2 (zCSkyControler_Outdoor__GetTime_G1, zCSkyControler_Outdoor__GetTime_G2));
call = CALL_End ();
};
return +retVal;
};
/*
* Engine function that returns current world time from zCSkyControler_Indoor
*/
func int zCSkyControler_Indoor_GetTime () {
//0x005B7F80 public: virtual float __thiscall zCSkyControler_Indoor::GetTime(void)const
const int zCSkyControler_Indoor__GetTime_G1 = 5996416;
//0x005DF560 public: virtual float __thiscall zCSkyControler_Indoor::GetTime(void)const
const int zCSkyControler_Indoor__GetTime_G2 = 6157664;
if (!MEM_World.skyControlerIndoor) { return FLOATNULL; };
var int retVal;
const int call = 0;
if (CALL_Begin (call)) {
CALL_RetValIsFloat ();
CALL_PutRetValTo(_@ (retVal));
CALL__thiscall (_@ (MEM_World.skyControlerIndoor), MEMINT_SwitchG1G2 (zCSkyControler_Indoor__GetTime_G1, zCSkyControler_Indoor__GetTime_G2));
call = CALL_End ();
};
return +retVal;
};
/*
* Function calculates hour from float time
*/
func int GetTime_GetHour (var int timeF) {
var int hh;
hh = mulf (timeF, mkf (24));
hh = (truncf (hh) + 12) % 24;
return hh; //int
};
/*
* Function calculates minute from float time
*/
func int GetTime_GetMinute (var int timeF) {
var int mm;
mm = mulf (timeF, mkf (24 * 60));
mm = truncf (mm) % (24 * 60);
mm = mm % 60;
return mm; //int
};
func int Wld_GetHour () {
// var int time; time = -1;
//
// if (!MEM_World.activeSkyControler) { return -1; };
//
// if (Hlp_Is_zCSkyControler_Outdoor (MEM_World.activeSkyControler)) {
// time = zCSkyControler_Outdoor_GetTime ();
// } else
//
// if (Hlp_Is_zCSkyControler_Indoor (MEM_World.activeSkyControler)) {
// time = zCSkyControler_Indoor_GetTime ();
// };
//
// return +GetTime_GetHour (time);
var int hour; var int min;
oCWorldTimer_GetTime (_@ (hour), _@ (min));
return +hour;
};
func int Wld_GetMinute () {
// var int time; time = -1;
//
// if (!MEM_World.activeSkyControler) { return -1; };
//
// if (Hlp_Is_zCSkyControler_Outdoor (MEM_World.activeSkyControler)) {
// time = zCSkyControler_Outdoor_GetTime ();
// } else
//
// if (Hlp_Is_zCSkyControler_Indoor (MEM_World.activeSkyControler)) {
// time = zCSkyControler_Indoor_GetTime ();
// };
//
// return +GetTime_GetMinute (time);
var int hour; var int min;
oCWorldTimer_GetTime (_@ (hour), _@ (min));
return +min;
};
func int Wld_GetTime () {
//var int h;
//h = Wld_GetHour ();
//h = h * 60 + Wld_GetMinute ();
//h = h + Wld_GetDay () * 24 * 60;
//return h;
var int hour; var int min;
oCWorldTimer_GetTime (_@ (hour), _@ (min));
var int t; t = hour * 60 + min + (Wld_GetDay () * 24 * 60);
return +t;
};