-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathomi.qc
248 lines (237 loc) · 6.33 KB
/
omi.qc
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/*
* QW-TF2003-qc
* Copyright (C) 2003-2004 [sd] angel
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#define SI_DETPIPE 1
#define SI_THROWGREN 2
#define SI_PRIMEONE 4
#define SI_PRIMETWO 8
#define SI_DISCARD 16 // fixme: do not save discard?
#define SI_INV 32
#define SI_ID 64
#define SI_SPECIAL 128
#define SI_RELOAD 256
void () Angel_SaveImpulse = {
if (self.impulse <= 9)
{
if (self.current_weapon == 8)
return;
self.imp1=self.impulse;
self.impulse = 0;
return;
}
if (self.impulse == 152 && (self.tfstate & #TFSTATE_GRENPRIMED))
self.tf_impulse = self.tf_impulse | #SI_THROWGREN;
else if (self.impulse == 170)
self.tf_impulse = self.tf_impulse | #SI_DETPIPE;
else if (self.impulse == 171)
self.tf_impulse = self.tf_impulse | #SI_SPECIAL;
else if (self.impulse == 173)
self.tf_impulse = self.tf_impulse | #SI_RELOAD;
else if (self.impulse == 184)
self.tf_impulse = self.tf_impulse | #SI_DISCARD;
else if (self.impulse == 150 && !(self.tfstate & #TFSTATE_GRENPRIMED))
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_PRIMETWO);
self.tf_impulse = self.tf_impulse | #SI_PRIMEONE;
}else
if (self.impulse == 151 && !(self.tfstate & #TFSTATE_GRENPRIMED)) {
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_PRIMEONE);
self.tf_impulse = self.tf_impulse | #SI_PRIMETWO;
}
else
return; // do not save impulse
self.impulse = 0; // reset impulse, chto by ne bylo gemora
}
float () Angel_GetSavedImpulse ={
local float saved;
// if (saved)
// return saved;
// throwgren MUST be after priming;
// special and reload MUST BE LAST!!!
if (self.tf_impulse & #SI_PRIMEONE)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_PRIMEONE);
return 150;
}
else if (self.tf_impulse & #SI_PRIMETWO)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_PRIMETWO);
return 151;
}
else if (self.tf_impulse & #SI_THROWGREN)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_THROWGREN);
return 152;
}
else if (self.tf_impulse & #SI_DETPIPE)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_DETPIPE);
return 170;
}
else if (self.imp1){
saved = self.imp1;
self.imp1 = 0;
return saved;
}else
if (self.tf_impulse & #SI_DISCARD)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_DISCARD);
return 184;
}
else if (self.tf_impulse & #SI_SPECIAL)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_SPECIAL);
return 171;
}
else if (self.tf_impulse & #SI_RELOAD)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_RELOAD);
return 173;
}
/* if (self.imp1){
saved = self.imp1;
self.imp1 = 0;
return saved;
}*/
return 0;
}
void () Omi_SaveImpulse = {
// save weapon impulse
if (self.impulse <= 9)
{
if (self.current_weapon == 8)
return;
if (!self.imp1)
{
self.imp1 = self.impulse;
self.impulse = 0;
}
else if (!self.imp2)
{
self.imp2 = self.imp1;
self.imp1 = self.impulse;
self.impulse = 0;
}
else if (!self.imp3)
{
if ((self.impulse != self.imp1) && (self.impulse != self.imp2))
{
self.imp3 = self.imp2;
self.imp2 = self.imp1;
self.imp1 = self.impulse;
self.impulse = 0;
}
}
else if (!self.imp4)
{
if ((self.impulse != self.imp2) && (self.impulse != self.imp3))
{
self.imp4 = self.imp3;
self.imp3 = self.imp2;
self.imp2 = self.imp1;
self.imp1 = self.impulse;
self.impulse = 0;
}
}
self.impulse = 0;
// if (self.current_weapon != 8)
// Omi_PreChangeWeapon(self.weapon_impulse);
return;
}
// save tf impulse
if (self.impulse == 152)
self.tf_impulse = self.tf_impulse | #SI_THROWGREN;
else if (self.impulse == 170)
self.tf_impulse = self.tf_impulse | #SI_DETPIPE;
else if (self.impulse == 171)
self.tf_impulse = self.tf_impulse | #SI_SPECIAL;
else if (self.impulse == 173)
self.tf_impulse = self.tf_impulse | #SI_RELOAD;
else if (self.impulse == 184)
self.tf_impulse = self.tf_impulse | #SI_DISCARD;
else if (self.impulse == 150)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_PRIMETWO);
self.tf_impulse = self.tf_impulse | #SI_PRIMEONE;
}
else if (self.impulse == 151) {
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_PRIMEONE);
self.tf_impulse = self.tf_impulse | #SI_PRIMETWO;
}
else
return; // do not save impulse
self.impulse = 0; // reset impulse, chto by ne bylo gemora
};
float () Omi_GetSavedImpulse =
{
local float saved;
if (self.imp4)
saved = self.imp4;
self.imp4 = 0;
if (self.imp3)
saved = self.imp3;
self.imp3 = 0;
if (self.imp2)
saved = self.imp2;
self.imp2 = 0;
if (self.imp1)
saved = self.imp1;
self.imp1 = 0;
if (saved)
return saved;
// throwgren MUST be after priming;
// special and reload MUST BE LAST!!!
if (self.tf_impulse & #SI_PRIMEONE)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_PRIMEONE);
return 150;
}
else if (self.tf_impulse & #SI_PRIMETWO)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_PRIMETWO);
return 151;
}
else if (self.tf_impulse & #SI_THROWGREN)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_THROWGREN);
return 152;
}
else if (self.tf_impulse & #SI_DETPIPE)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_DETPIPE);
return 170;
}
else if (self.tf_impulse & #SI_DISCARD)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_DISCARD);
return 184;
}
else if (self.tf_impulse & #SI_SPECIAL)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_SPECIAL);
return 171;
}
else if (self.tf_impulse & #SI_RELOAD)
{
self.tf_impulse = self.tf_impulse - (self.tf_impulse & #SI_RELOAD);
return 173;
}
return 0;
};