forked from Bad-Scientists/AF-Script-Packet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.d
170 lines (129 loc) · 3.28 KB
/
menu.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
169
170
/*
* Menu
*/
/*
* oCLogTopic functions
*/
/*
* Log_GetTopic
* - returns topic pointer
*/
func int Log_GetTopic (var string topicName) {
var zCList l;
var int list; list = oCLogManager_Ptr;
while (list);
l = _^ (list);
if (l.data) {
var oCLogTopic logTopic; logTopic = _^ (l.data);
if (Hlp_StrCmp (logTopic.m_strDescription, topicName)) {
return l.data;
};
};
list = l.next;
end;
return 0;
};
/*
* Log_GetTopicStatus
* - returns topic status
*/
func int Log_GetTopicStatus (var string topicName) {
var int ptr; ptr = Log_GetTopic (topicName);
if (!ptr) { return LOG_STATUS_INVALID; };
var oCLogTopic logTopic; logTopic = _^ (ptr);
return logTopic.m_enuStatus;
};
/*
* Log_GetTopicSection
* - returns topic section
*/
func int Log_GetTopicSection (var string topicName) {
var int ptr; ptr = Log_GetTopic (topicName);
if (!ptr) { return LOG_SECTION_INVALID; };
var oCLogTopic logTopic; logTopic = _^ (ptr);
return logTopic.m_enuSection;
};
/*
* Log_GetNoOfEntries
* - returns no of entries in the topic
*/
func int Log_GetNoOfEntries (var string topicName) {
var int ptr; ptr = Log_GetTopic (topicName);
if (!ptr) { return 0; };
var oCLogTopic logTopic; logTopic = _^ (ptr);
if (!logTopic.m_lstEntries_next) { return 0; };
var zCList l;
var int list; list = logTopic.m_lstEntries_next;
var int count; count = 0;
while (list);
l = _^ (list);
if (l.data) {
count += 1;
};
list = l.next;
end;
return count;
};
/*
* Log_GetEntryByIndex
* - returns enry by index
*/
func string Log_GetEntryByIndex (var string topicName, var int index) {
var int ptr; ptr = Log_GetTopic (topicName);
if (!ptr) { return ""; };
var oCLogTopic logTopic; logTopic = _^ (ptr);
if (!logTopic.m_lstEntries_next) { return ""; };
var zCList l;
var int list; list = logTopic.m_lstEntries_next;
var int count; count = 0;
while (list);
l = _^ (list);
if (l.data) {
if (count == index) {
var string entry; entry = MEM_ReadString (l.data);
return entry;
};
count += 1;
};
list = l.next;
end;
return "";
};
/*
* Log_GetNoOfTopics
* - returns no of topics in specific section with specified status
*/
func int Log_GetNoOfTopics(var int logSection, var int logStatus) {
var zCList l;
var int list; list = oCLogManager_Ptr;
var int count; count = 0;
while (list);
l = _^ (list);
if (l.data) {
var oCLogTopic logTopic; logTopic = _^ (l.data);
if ((logTopic.m_enuSection == logSection) || (logSection == -1)) {
if ((logTopic.m_enuStatus == logStatus) || (logStatus == -1)) {
count += 1;
};
};
};
list = l.next;
end;
return count;
};
/*
* zCMenuItem functions
*/
/*
* zCMenuItem_GetByName
* - same as MEM_GetMenuItemBystring ?
*/
func int zCMenuItem_GetByName (var string menuItemName) {
//0x004D17A0 public: static class zCMenuItem * __cdecl zCMenuItem::GetByName(class zSTRING const &)
const int zCMenuItem__GetByName_G1 = 5052320;
//0x004DE5F0 public: static class zCMenuItem * __cdecl zCMenuItem::GetByName(class zSTRING const &)
const int zCMenuItem__GetByName_G2 = 5105136;
CALL_zStringPtrParam (menuItemName);
CALL__cdecl (MEMINT_SwitchG1G2(zCMenuItem__GetByName_G1, zCMenuItem__GetByName_G2));
return CALL_RetValAsPtr ();
};