author | nemo |
Thu, 25 Nov 2010 22:56:28 -0500 | |
changeset 4420 | 6be946bcd17a |
parent 4379 | 6cd6b77df8b8 |
child 4421 | 58c6918acde4 |
permissions | -rw-r--r-- |
3441 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
3 |
* Copyright (c) 2004-2010 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*) |
|
18 |
procedure doStepFlake(Gear: PVisualGear; Steps: Longword); |
|
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
19 |
var sign: real; |
3441 | 20 |
begin |
3641 | 21 |
if vobCount = 0 then exit; |
3611 | 22 |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
23 |
sign:= 1; |
3441 | 24 |
with Gear^ do |
25 |
begin |
|
26 |
inc(FrameTicks, Steps); |
|
27 |
if FrameTicks > vobFrameTicks then |
|
28 |
begin |
|
29 |
dec(FrameTicks, vobFrameTicks); |
|
30 |
inc(Frame); |
|
31 |
if Frame = vobFramesCount then Frame:= 0 |
|
32 |
end; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
33 |
X:= X + (cWindSpeedf * 200 + dX + tdX) * Steps; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
34 |
Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps; |
3441 | 35 |
Angle:= Angle + dAngle * Steps; |
4152
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
36 |
if Angle > 360 then |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
37 |
Angle:= Angle - 360 |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
38 |
else |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
39 |
if Angle < - 360 then |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
40 |
Angle:= Angle + 360; |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
41 |
|
3441 | 42 |
|
3764 | 43 |
if (round(X) >= cLeftScreenBorder) and |
44 |
(round(X) <= cRightScreenBorder) and |
|
4161 | 45 |
(round(Y) - 75 <= LAND_HEIGHT) and |
3441 | 46 |
(Timer > 0) and (Timer-Steps > 0) then |
47 |
begin |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
48 |
if tdX > 0 then sign := 1 |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
49 |
else sign:= -1; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
50 |
tdX:= tdX - 0.005*Steps*sign; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
51 |
if ((sign < 0) and (tdX > 0)) or ((sign > 0) and (tdX < 0)) then tdX:= 0; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
52 |
if tdX > 0 then sign := 1 |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
53 |
else sign:= -1; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
54 |
tdY:= tdY - 0.005*Steps*sign; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
55 |
if ((sign < 0) and (tdY > 0)) or ((sign > 0) and (tdY < 0)) then tdY:= 0; |
3441 | 56 |
dec(Timer, Steps) |
57 |
end |
|
58 |
else |
|
59 |
begin |
|
3764 | 60 |
if round(X) < cLeftScreenBorder then X:= X + cScreenSpace else |
61 |
if round(X) > cRightScreenBorder then X:= X - cScreenSpace; |
|
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
62 |
// if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + 25.0; // For if flag is set for flakes rising upwards? |
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
63 |
if round(Y) - 75 > LAND_HEIGHT then Y:= Y - (1024 + 150); // TODO - configure in theme (jellies for example could use limited range) |
3441 | 64 |
Timer:= 0; |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
65 |
tdX:= 0; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
66 |
tdY:= 0 |
3441 | 67 |
end; |
68 |
end; |
|
69 |
||
70 |
end; |
|
71 |
||
72 |
//////////////////////////////////////////////////////////////////////////////// |
|
73 |
procedure doStepBeeTrace(Gear: PVisualGear; Steps: Longword); |
|
74 |
begin |
|
75 |
if Gear^.FrameTicks > Steps then |
|
76 |
dec(Gear^.FrameTicks, Steps) |
|
77 |
else |
|
78 |
DeleteVisualGear(Gear); |
|
79 |
end; |
|
80 |
||
81 |
//////////////////////////////////////////////////////////////////////////////// |
|
82 |
procedure doStepCloud(Gear: PVisualGear; Steps: Longword); |
|
3592
0bcad5c38c9e
clouds: up-and-down-bouncing now without evil loop
sheepluva
parents:
3590
diff
changeset
|
83 |
var s: Longword; |
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
84 |
t: real; |
3441 | 85 |
begin |
3994
486da687d76a
fix/tweak let clouds reflect wind speed and direction again + stronger
sheepluva
parents:
3976
diff
changeset
|
86 |
Gear^.X:= Gear^.X + (cWindSpeedf * 750 * Gear^.dX) * Steps; |
3441 | 87 |
|
3592
0bcad5c38c9e
clouds: up-and-down-bouncing now without evil loop
sheepluva
parents:
3590
diff
changeset
|
88 |
// up-and-down-bounce magic |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
89 |
s := (GameTicks + Gear^.Timer) mod 4096; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
90 |
t := 8 * AngleSin(s mod 2048).QWordValue / 4294967296; |
3597
978c30ef50fc
visual gears: fixing nemo's c-style assignment/multiplications
sheepluva
parents:
3593
diff
changeset
|
91 |
if (s < 2048) then t := -t; |
3441 | 92 |
|
4161 | 93 |
Gear^.Y := LAND_HEIGHT - 1184 + LongInt(Gear^.Timer mod 8) + t; |
3441 | 94 |
|
3764 | 95 |
if round(Gear^.X) < cLeftScreenBorder then Gear^.X:= Gear^.X + cScreenSpace else |
96 |
if round(Gear^.X) > cRightScreenBorder then Gear^.X:= Gear^.X - cScreenSpace |
|
3441 | 97 |
end; |
98 |
||
99 |
//////////////////////////////////////////////////////////////////////////////// |
|
100 |
procedure doStepExpl(Gear: PVisualGear; Steps: Longword); |
|
101 |
begin |
|
102 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
103 |
||
104 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
105 |
//Gear^.dY:= Gear^.dY + cGravityf; |
3441 | 106 |
|
107 |
if Gear^.FrameTicks <= Steps then |
|
108 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
109 |
else |
|
110 |
begin |
|
111 |
dec(Gear^.Frame); |
|
112 |
Gear^.FrameTicks:= cExplFrameTicks |
|
113 |
end |
|
114 |
else dec(Gear^.FrameTicks, Steps) |
|
115 |
end; |
|
116 |
||
117 |
//////////////////////////////////////////////////////////////////////////////// |
|
3704 | 118 |
procedure doStepNote(Gear: PVisualGear; Steps: Longword); |
119 |
begin |
|
120 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
121 |
||
122 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3706 | 123 |
Gear^.dY:= Gear^.dY + cGravityf * Steps / 2; |
3704 | 124 |
|
3706 | 125 |
Gear^.Angle:= Gear^.Angle + (Gear^.Frame + 1) * Steps / 10; |
126 |
while Gear^.Angle > cMaxAngle do |
|
127 |
Gear^.Angle:= Gear^.Angle - cMaxAngle; |
|
3704 | 128 |
|
129 |
if Gear^.FrameTicks <= Steps then |
|
130 |
DeleteVisualGear(Gear) |
|
131 |
else |
|
132 |
dec(Gear^.FrameTicks, Steps) |
|
133 |
end; |
|
134 |
||
135 |
//////////////////////////////////////////////////////////////////////////////// |
|
4279 | 136 |
procedure doStepLineTrail(Gear: PVisualGear; Steps: Longword); |
137 |
begin |
|
138 |
Steps := Steps; |
|
139 |
if Gear^.Timer <= Steps then |
|
140 |
DeleteVisualGear(Gear) |
|
141 |
else |
|
142 |
dec(Gear^.Timer, Steps) |
|
143 |
end; |
|
144 |
||
145 |
//////////////////////////////////////////////////////////////////////////////// |
|
3441 | 146 |
procedure doStepEgg(Gear: PVisualGear; Steps: Longword); |
147 |
begin |
|
148 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
149 |
||
150 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
151 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 152 |
|
153 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
154 |
||
155 |
if Gear^.FrameTicks <= Steps then |
|
156 |
DeleteVisualGear(Gear) |
|
157 |
else |
|
158 |
dec(Gear^.FrameTicks, Steps) |
|
159 |
end; |
|
160 |
||
161 |
//////////////////////////////////////////////////////////////////////////////// |
|
162 |
procedure doStepFire(Gear: PVisualGear; Steps: Longword); |
|
3751 | 163 |
var vgt: PVisualGear; |
3441 | 164 |
begin |
165 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
166 |
||
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
167 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravityf * (Steps * Steps); |
3751 | 168 |
if (Gear^.State and gstTmpFlag) = 0 then |
169 |
begin |
|
170 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
3764 | 171 |
if ((GameTicks mod 200) < Steps + 1) then |
3751 | 172 |
begin |
173 |
vgt:= AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtFire); |
|
174 |
if vgt <> nil then |
|
175 |
begin |
|
176 |
vgt^.dx:= 0; |
|
177 |
vgt^.dy:= 0; |
|
178 |
vgt^.State:= gstTmpFlag; |
|
179 |
end; |
|
180 |
end |
|
181 |
end |
|
182 |
else |
|
183 |
inc(Steps, Steps); |
|
3441 | 184 |
|
185 |
if Gear^.FrameTicks <= Steps then |
|
186 |
DeleteVisualGear(Gear) |
|
187 |
else |
|
188 |
dec(Gear^.FrameTicks, Steps) |
|
189 |
end; |
|
190 |
||
191 |
//////////////////////////////////////////////////////////////////////////////// |
|
192 |
procedure doStepShell(Gear: PVisualGear; Steps: Longword); |
|
193 |
begin |
|
194 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
195 |
||
196 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
197 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 198 |
|
199 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
200 |
||
201 |
if Gear^.FrameTicks <= Steps then |
|
202 |
DeleteVisualGear(Gear) |
|
203 |
else |
|
204 |
dec(Gear^.FrameTicks, Steps) |
|
205 |
end; |
|
206 |
||
207 |
procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword); |
|
208 |
begin |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
209 |
Gear^.Y:= Gear^.Y - 0.02 * Steps; |
3441 | 210 |
|
211 |
if Gear^.FrameTicks <= Steps then |
|
212 |
DeleteVisualGear(Gear) |
|
213 |
else |
|
214 |
dec(Gear^.FrameTicks, Steps) |
|
215 |
end; |
|
216 |
||
217 |
//////////////////////////////////////////////////////////////////////////////// |
|
218 |
procedure doStepBubble(Gear: PVisualGear; Steps: Longword); |
|
219 |
begin |
|
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3764
diff
changeset
|
220 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3764
diff
changeset
|
221 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
222 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 223 |
|
4172 | 224 |
Gear^.dX := Gear^.dX / (1.001 * Steps); |
225 |
Gear^.dY := Gear^.dY / (1.001 * Steps); |
|
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3764
diff
changeset
|
226 |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
227 |
if (Gear^.FrameTicks <= Steps) or (round(Gear^.Y) < cWaterLine) then |
3441 | 228 |
DeleteVisualGear(Gear) |
229 |
else |
|
230 |
dec(Gear^.FrameTicks, Steps) |
|
231 |
end; |
|
232 |
||
233 |
//////////////////////////////////////////////////////////////////////////////// |
|
234 |
procedure doStepHealth(Gear: PVisualGear; Steps: Longword); |
|
235 |
begin |
|
236 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
237 |
Gear^.Y:= Gear^.Y - Gear^.dY * Steps; |
|
238 |
||
239 |
if Gear^.FrameTicks <= Steps then |
|
240 |
DeleteVisualGear(Gear) |
|
241 |
else |
|
242 |
dec(Gear^.FrameTicks, Steps); |
|
243 |
end; |
|
244 |
||
245 |
//////////////////////////////////////////////////////////////////////////////// |
|
246 |
procedure doStepSteam(Gear: PVisualGear; Steps: Longword); |
|
247 |
begin |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
248 |
Gear^.X:= Gear^.X + (cWindSpeedf * 100 + Gear^.dX) * Steps; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
249 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 250 |
|
251 |
if Gear^.FrameTicks <= Steps then |
|
252 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
253 |
else |
|
254 |
begin |
|
255 |
if Random(2) = 0 then dec(Gear^.Frame); |
|
256 |
Gear^.FrameTicks:= cExplFrameTicks |
|
257 |
end |
|
258 |
else dec(Gear^.FrameTicks, Steps) |
|
259 |
end; |
|
260 |
||
261 |
//////////////////////////////////////////////////////////////////////////////// |
|
262 |
procedure doStepAmmo(Gear: PVisualGear; Steps: Longword); |
|
263 |
begin |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
264 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 265 |
|
266 |
Gear^.scale:= Gear^.scale + 0.0025 * Steps; |
|
267 |
Gear^.alpha:= Gear^.alpha - 0.0015 * Steps; |
|
268 |
||
269 |
if Gear^.alpha < 0 then DeleteVisualGear(Gear) |
|
270 |
end; |
|
271 |
||
272 |
//////////////////////////////////////////////////////////////////////////////// |
|
273 |
procedure doStepSmoke(Gear: PVisualGear; Steps: Longword); |
|
274 |
begin |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
275 |
Gear^.X:= Gear^.X + (cWindSpeedf + Gear^.dX) * Steps; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
276 |
Gear^.Y:= Gear^.Y - (cDrownSpeedf + Gear^.dY) * Steps; |
3441 | 277 |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
278 |
Gear^.dX := Gear^.dX + (cWindSpeedf * 0.3 * Steps); |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
279 |
//Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.995); |
3441 | 280 |
|
281 |
if Gear^.FrameTicks <= Steps then |
|
282 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
283 |
else |
|
284 |
begin |
|
285 |
if Random(2) = 0 then dec(Gear^.Frame); |
|
286 |
Gear^.FrameTicks:= cExplFrameTicks |
|
287 |
end |
|
288 |
else dec(Gear^.FrameTicks, Steps) |
|
289 |
end; |
|
290 |
||
291 |
//////////////////////////////////////////////////////////////////////////////// |
|
292 |
procedure doStepDust(Gear: PVisualGear; Steps: Longword); |
|
293 |
begin |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
294 |
Gear^.X:= Gear^.X + (cWindSpeedf + (cWindSpeedf * 0.03 * Steps) + Gear^.dX) * Steps; |
3441 | 295 |
Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps; |
296 |
||
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
297 |
Gear^.dX := Gear^.dX - (Gear^.dX * 0.005 * Steps); |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
298 |
Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.001 * Steps); |
3441 | 299 |
|
300 |
if Gear^.FrameTicks <= Steps then |
|
301 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
302 |
else |
|
303 |
begin |
|
304 |
dec(Gear^.Frame); |
|
305 |
Gear^.FrameTicks:= cExplFrameTicks |
|
306 |
end |
|
307 |
else dec(Gear^.FrameTicks, Steps) |
|
308 |
end; |
|
309 |
||
310 |
//////////////////////////////////////////////////////////////////////////////// |
|
311 |
procedure doStepSplash(Gear: PVisualGear; Steps: Longword); |
|
312 |
begin |
|
313 |
if Gear^.FrameTicks <= Steps then |
|
314 |
DeleteVisualGear(Gear) |
|
315 |
else |
|
316 |
dec(Gear^.FrameTicks, Steps); |
|
317 |
end; |
|
318 |
||
319 |
//////////////////////////////////////////////////////////////////////////////// |
|
320 |
procedure doStepDroplet(Gear: PVisualGear; Steps: Longword); |
|
321 |
begin |
|
322 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
323 |
||
324 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
325 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 326 |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
327 |
if round(Gear^.Y) > cWaterLine then begin |
3441 | 328 |
DeleteVisualGear(Gear); |
329 |
PlaySound(TSound(ord(sndDroplet1) + Random(3))); |
|
330 |
end; |
|
331 |
end; |
|
332 |
||
333 |
//////////////////////////////////////////////////////////////////////////////// |
|
334 |
procedure doStepSmokeRing(Gear: PVisualGear; Steps: Longword); |
|
335 |
begin |
|
336 |
inc(Gear^.Timer, Steps); |
|
337 |
if Gear^.Timer >= Gear^.FrameTicks then DeleteVisualGear(Gear) |
|
338 |
else |
|
339 |
begin |
|
340 |
Gear^.scale := 1.25 * (-power(2, -10 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4; |
|
341 |
Gear^.alpha := 1 - power(Gear^.Timer / 350, 4); |
|
342 |
if Gear^.alpha < 0 then Gear^.alpha:= 0; |
|
343 |
end; |
|
344 |
end; |
|
345 |
||
346 |
//////////////////////////////////////////////////////////////////////////////// |
|
347 |
procedure doStepFeather(Gear: PVisualGear; Steps: Longword); |
|
348 |
begin |
|
349 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
350 |
||
351 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
352 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 353 |
|
354 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
355 |
||
356 |
if Gear^.FrameTicks <= Steps then |
|
357 |
DeleteVisualGear(Gear) |
|
358 |
else |
|
359 |
dec(Gear^.FrameTicks, Steps) |
|
360 |
end; |
|
361 |
||
362 |
//////////////////////////////////////////////////////////////////////////////// |
|
363 |
const cSorterWorkTime = 640; |
|
364 |
var thexchar: array[0..cMaxTeams] of |
|
365 |
record |
|
366 |
dy, ny, dw: LongInt; |
|
367 |
team: PTeam; |
|
368 |
SortFactor: QWord; |
|
369 |
end; |
|
370 |
currsorter: PVisualGear = nil; |
|
371 |
||
372 |
procedure doStepTeamHealthSorterWork(Gear: PVisualGear; Steps: Longword); |
|
373 |
var i, t: LongInt; |
|
374 |
begin |
|
375 |
for t:= 1 to Steps do |
|
376 |
begin |
|
377 |
dec(Gear^.Timer); |
|
378 |
if (Gear^.Timer and 15) = 0 then |
|
379 |
for i:= 0 to Pred(TeamsCount) do |
|
380 |
with thexchar[i] do |
|
381 |
begin |
|
382 |
{$WARNINGS OFF} |
|
383 |
team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer) div 640; |
|
384 |
team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * LongInt(Gear^.Timer) div cSorterWorkTime; |
|
385 |
{$WARNINGS ON} |
|
386 |
end; |
|
387 |
||
388 |
if (Gear^.Timer = 0) or (currsorter <> Gear) then |
|
389 |
begin |
|
390 |
if currsorter = Gear then currsorter:= nil; |
|
391 |
DeleteVisualGear(Gear); |
|
392 |
exit |
|
393 |
end |
|
394 |
end |
|
395 |
end; |
|
396 |
||
397 |
procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword); |
|
398 |
var i: Longword; |
|
399 |
b: boolean; |
|
400 |
t: LongInt; |
|
401 |
begin |
|
402 |
Steps:= Steps; // avoid compiler hint |
|
403 |
for t:= 0 to Pred(TeamsCount) do |
|
404 |
with thexchar[t] do |
|
405 |
begin |
|
406 |
dy:= TeamsArray[t]^.DrawHealthY; |
|
407 |
dw:= TeamsArray[t]^.TeamHealthBarWidth - TeamsArray[t]^.NewTeamHealthBarWidth; |
|
408 |
team:= TeamsArray[t]; |
|
409 |
SortFactor:= TeamsArray[t]^.Clan^.ClanHealth; |
|
410 |
SortFactor:= (SortFactor shl 3) + TeamsArray[t]^.Clan^.ClanIndex; |
|
411 |
SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth; |
|
412 |
end; |
|
413 |
||
414 |
if TeamsCount > 1 then |
|
415 |
repeat |
|
416 |
b:= true; |
|
417 |
for t:= 0 to TeamsCount - 2 do |
|
418 |
if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then |
|
419 |
begin |
|
420 |
thexchar[cMaxTeams]:= thexchar[t]; |
|
421 |
thexchar[t]:= thexchar[Succ(t)]; |
|
422 |
thexchar[Succ(t)]:= thexchar[cMaxTeams]; |
|
423 |
b:= false |
|
424 |
end |
|
425 |
until b; |
|
426 |
||
427 |
t:= - 4; |
|
428 |
for i:= 0 to Pred(TeamsCount) do |
|
429 |
with thexchar[i] do |
|
430 |
begin |
|
431 |
dec(t, team^.HealthTex^.h + 2); |
|
432 |
ny:= t; |
|
433 |
dy:= dy - ny |
|
434 |
end; |
|
435 |
||
436 |
Gear^.Timer:= cSorterWorkTime; |
|
437 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
|
438 |
currsorter:= Gear; |
|
439 |
//doStepTeamHealthSorterWork(Gear, Steps) |
|
440 |
end; |
|
441 |
||
442 |
//////////////////////////////////////////////////////////////////////////////// |
|
443 |
procedure doStepSpeechBubbleWork(Gear: PVisualGear; Steps: Longword); |
|
444 |
begin |
|
445 |
if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0; |
|
446 |
||
4365 | 447 |
if (Gear^.Hedgehog^.Gear <> nil) then |
3441 | 448 |
begin |
4365 | 449 |
Gear^.X:= Gear^.Hedgehog^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2 - Gear^.FrameTicks); |
450 |
Gear^.Y:= Gear^.Hedgehog^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h); |
|
3441 | 451 |
end; |
452 |
||
453 |
if Gear^.Timer = 0 then |
|
454 |
begin |
|
4365 | 455 |
if Gear^.Hedgehog^.SpeechGear = Gear then |
456 |
Gear^.Hedgehog^.SpeechGear:= nil; |
|
3441 | 457 |
DeleteVisualGear(Gear) |
458 |
end; |
|
459 |
end; |
|
460 |
||
461 |
procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword); |
|
462 |
begin |
|
463 |
Steps:= Steps; // avoid compiler hint |
|
464 |
||
4365 | 465 |
with Gear^.Hedgehog^ do |
3441 | 466 |
if SpeechGear <> nil then SpeechGear^.Timer:= 0; |
467 |
||
4365 | 468 |
Gear^.Hedgehog^.SpeechGear:= Gear; |
3441 | 469 |
|
470 |
Gear^.Timer:= max(Length(Gear^.Text) * 150, 3000); |
|
471 |
||
472 |
Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16); |
|
473 |
||
474 |
case Gear^.FrameTicks of |
|
475 |
1: Gear^.FrameTicks:= SpritesData[sprSpeechTail].Width-28; |
|
476 |
2: Gear^.FrameTicks:= SpritesData[sprThoughtTail].Width-20; |
|
477 |
3: Gear^.FrameTicks:= SpritesData[sprShoutTail].Width-10; |
|
478 |
end; |
|
479 |
||
480 |
Gear^.doStep:= @doStepSpeechBubbleWork; |
|
481 |
||
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
482 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h |
3441 | 483 |
end; |
484 |
||
485 |
//////////////////////////////////////////////////////////////////////////////// |
|
486 |
procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword); |
|
487 |
begin |
|
488 |
if Steps > Gear^.Timer then |
|
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
489 |
DeleteVisualGear(Gear) |
3441 | 490 |
else |
491 |
begin |
|
492 |
dec(Gear^.Timer, Steps); |
|
493 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
494 |
end; |
|
495 |
end; |
|
496 |
||
497 |
procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword); |
|
498 |
begin |
|
4161 | 499 |
if round(Gear^.Y) - 10 < cWaterLine then |
3441 | 500 |
DeleteVisualGear(Gear) |
501 |
else |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
502 |
Gear^.Y:= Gear^.Y - 0.08 * Steps; |
3441 | 503 |
|
504 |
end; |
|
505 |
||
506 |
procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword); |
|
507 |
var s: shortstring; |
|
508 |
begin |
|
509 |
s:= ''; |
|
510 |
||
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
511 |
Gear^.dY:= -0.08; |
3441 | 512 |
|
513 |
str(Gear^.State, s); |
|
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
514 |
if Gear^.Hedgehog <> nil then |
4365 | 515 |
Gear^.Tex:= RenderStringTex(s, Gear^.Hedgehog^.Team^.Clan^.Color, fnt16) |
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
516 |
else |
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
517 |
Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16); |
3441 | 518 |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
519 |
if round(Gear^.Y) < cWaterLine then |
3441 | 520 |
Gear^.doStep:= @doStepHealthTagWork |
521 |
else |
|
522 |
Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
|
523 |
||
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
524 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h; |
3441 | 525 |
|
526 |
if Steps > 1 then Gear^.doStep(Gear, Steps-1); |
|
527 |
end; |
|
528 |
||
529 |
//////////////////////////////////////////////////////////////////////////////// |
|
530 |
procedure doStepSmokeTrace(Gear: PVisualGear; Steps: Longword); |
|
531 |
begin |
|
532 |
inc(Gear^.Timer, Steps ); |
|
533 |
if Gear^.Timer > 64 then |
|
534 |
begin |
|
3995
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
535 |
if Gear^.State = 0 then |
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
536 |
begin |
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
537 |
DeleteVisualGear(Gear); |
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
538 |
exit; |
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
539 |
end; |
3441 | 540 |
dec(Gear^.State, Gear^.Timer div 65); |
541 |
Gear^.Timer:= Gear^.Timer mod 65; |
|
542 |
end; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
543 |
Gear^.dX:= Gear^.dX + cWindSpeedf * Steps; |
3587 | 544 |
Gear^.X:= Gear^.X + Gear^.dX; |
3441 | 545 |
end; |
546 |
||
547 |
//////////////////////////////////////////////////////////////////////////////// |
|
548 |
procedure doStepExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
549 |
begin |
|
550 |
inc(Gear^.Timer, Steps); |
|
551 |
if Gear^.Timer > 75 then |
|
552 |
begin |
|
553 |
inc(Gear^.State, Gear^.Timer div 76); |
|
554 |
Gear^.Timer:= Gear^.Timer mod 76; |
|
555 |
if Gear^.State > 5 then DeleteVisualGear(Gear); |
|
556 |
end; |
|
557 |
end; |
|
558 |
||
559 |
procedure doStepExplosion(Gear: PVisualGear; Steps: Longword); |
|
560 |
var i: LongWord; |
|
3590 | 561 |
gX,gY: LongInt; |
3441 | 562 |
begin |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
563 |
gX:= round(Gear^.X); |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
564 |
gY:= round(Gear^.Y); |
3590 | 565 |
for i:= 0 to 31 do AddVisualGear(gX, gY, vgtFire); |
566 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart); |
|
567 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart2); |
|
3441 | 568 |
Gear^.doStep:= @doStepExplosionWork; |
569 |
if Steps > 1 then Gear^.doStep(Gear, Steps-1); |
|
570 |
end; |
|
571 |
||
572 |
||
573 |
//////////////////////////////////////////////////////////////////////////////// |
|
574 |
procedure doStepBigExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
3587 | 575 |
//var maxMovement: LongInt; |
3441 | 576 |
begin |
577 |
||
578 |
inc(Gear^.Timer, Steps); |
|
3466
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
579 |
(* |
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
580 |
FIXME - This block desyncs due to the way WorldDx is important for various things network related. |
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
581 |
One possible solution is, instead of using WorldDx, to use straight gl/SDL calls to jitter the screen a bit. |
3441 | 582 |
if (Gear^.Timer and 5) = 0 then |
583 |
begin |
|
584 |
maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250)); |
|
585 |
ShakeCamera(maxMovement); |
|
586 |
end; |
|
3466
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
587 |
*) |
3441 | 588 |
if Gear^.Timer > 250 then DeleteVisualGear(Gear); |
589 |
end; |
|
590 |
||
591 |
procedure doStepBigExplosion(Gear: PVisualGear; Steps: Longword); |
|
592 |
var i: LongWord; |
|
593 |
gX,gY: LongInt; |
|
594 |
begin |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
595 |
gX:= round(Gear^.X); |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
596 |
gY:= round(Gear^.Y); |
3441 | 597 |
AddVisualGear(gX, gY, vgtSmokeRing); |
598 |
for i:= 0 to 46 do AddVisualGear(gX, gY, vgtFire); |
|
599 |
for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart); |
|
600 |
for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart2); |
|
601 |
Gear^.doStep:= @doStepBigExplosionWork; |
|
602 |
if Steps > 1 then Gear^.doStep(Gear, Steps-1); |
|
4034
634a8c8682de
add some phone rumbling to big explosions, airbomb and sinegun
koda
parents:
3995
diff
changeset
|
603 |
performRumble(); |
3441 | 604 |
end; |
3689 | 605 |
|
606 |
procedure doStepChunk(Gear: PVisualGear; Steps: Longword); |
|
607 |
begin |
|
608 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
609 |
||
610 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
611 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
612 |
||
613 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
614 |
||
615 |
if round(Gear^.Y) > cWaterLine then |
|
616 |
begin |
|
3699 | 617 |
AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtDroplet); |
3689 | 618 |
DeleteVisualGear(Gear); |
619 |
end |
|
620 |
end; |
|
4327 | 621 |
|
622 |
//////////////////////////////////////////////////////////////////////////////// |
|
623 |
procedure doStepBulletHit(Gear: PVisualGear; Steps: Longword); |
|
624 |
begin |
|
625 |
if Gear^.FrameTicks <= Steps then |
|
626 |
DeleteVisualGear(Gear) |
|
627 |
else |
|
628 |
dec(Gear^.FrameTicks, Steps); |
|
629 |
end; |
|
4420
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
630 |
|
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
631 |
//////////////////////////////////////////////////////////////////////////////// |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
632 |
procedure doStepCircle(Gear: PVisualGear; Steps: Longword); |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
633 |
var tmp: byte; |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
634 |
begin |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
635 |
with Gear^ do |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
636 |
if Frame <> 0 then |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
637 |
begin |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
638 |
inc(FrameTicks, Steps); |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
639 |
if (FrameTicks mod Frame) = 0 then |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
640 |
begin |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
641 |
tmp:= Gear^.Tint and $FF; |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
642 |
if tdY >= 0 then inc(tmp) |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
643 |
else dec(tmp); |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
644 |
if tmp < round(dX) then tdY:= 1; |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
645 |
if tmp > round(dY) then tdY:= -1; |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
646 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or tmp |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
647 |
end |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
648 |
end |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
649 |
end; |