author | sheepluva |
Mon, 17 May 2010 09:45:46 +0000 | |
changeset 3472 | b1832a3761e6 |
parent 3466 | 78d9fa9a700e |
child 3587 | eca835df4106 |
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); |
|
19 |
var sign: hwFloat; |
|
20 |
begin |
|
21 |
sign:= _1; |
|
22 |
with Gear^ do |
|
23 |
begin |
|
24 |
inc(FrameTicks, Steps); |
|
25 |
if FrameTicks > vobFrameTicks then |
|
26 |
begin |
|
27 |
dec(FrameTicks, vobFrameTicks); |
|
28 |
inc(Frame); |
|
29 |
if Frame = vobFramesCount then Frame:= 0 |
|
30 |
end; |
|
31 |
X:= X + (cWindSpeed * 200 + dX + tdX) * Steps; |
|
32 |
Y:= Y + (dY + tdY + cGravity * vobFallSpeed) * Steps; |
|
33 |
Angle:= Angle + dAngle * Steps; |
|
34 |
||
35 |
if (hwRound(X) >= -cScreenWidth - 64) and |
|
36 |
(hwRound(X) <= cScreenWidth + LAND_WIDTH) and |
|
37 |
(hwRound(Y) <= (LAND_HEIGHT + 75)) and |
|
38 |
(Timer > 0) and (Timer-Steps > 0) then |
|
39 |
begin |
|
40 |
sign.isNegative:=tdX.isNegative; |
|
41 |
tdX:= tdX - _0_005*Steps*sign; |
|
42 |
if (sign.isNegative and (tdX > _0)) or (not sign.isNegative and (tdX < _0)) then tdX:= _0; |
|
43 |
sign.isNegative:=tdY.isNegative; |
|
44 |
tdY:= tdY - _0_005*Steps*sign; |
|
45 |
if (sign.isNegative and (tdY > _0)) or (not sign.isNegative and (tdY < _0)) then tdY:= _0; |
|
46 |
dec(Timer, Steps) |
|
47 |
end |
|
48 |
else |
|
49 |
begin |
|
50 |
if hwRound(X) < -cScreenWidth - 64 then X:= int2hwFloat(cScreenWidth + LAND_WIDTH) else |
|
51 |
if hwRound(X) > cScreenWidth + LAND_WIDTH then X:= int2hwFloat(-cScreenWidth - 64); |
|
52 |
// if hwRound(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + int2hwFloat(25); // For if flag is set for flakes rising upwards? |
|
53 |
if hwRound(Y) > (LAND_HEIGHT + 75) then Y:= Y - int2hwFloat(1024 + 150); // TODO - configure in theme (jellies for example could use limited range) |
|
54 |
Timer:= 0; |
|
55 |
tdX:= _0; |
|
56 |
tdY:= _0 |
|
57 |
end; |
|
58 |
end; |
|
59 |
||
60 |
end; |
|
61 |
||
62 |
//////////////////////////////////////////////////////////////////////////////// |
|
63 |
procedure doStepBeeTrace(Gear: PVisualGear; Steps: Longword); |
|
64 |
begin |
|
65 |
if Gear^.FrameTicks > Steps then |
|
66 |
dec(Gear^.FrameTicks, Steps) |
|
67 |
else |
|
68 |
DeleteVisualGear(Gear); |
|
69 |
end; |
|
70 |
||
71 |
//////////////////////////////////////////////////////////////////////////////// |
|
72 |
procedure doStepCloud(Gear: PVisualGear; Steps: Longword); |
|
73 |
var i: Longword; |
|
74 |
begin |
|
75 |
Gear^.X:= Gear^.X + (cWindSpeed * 200 + Gear^.dX) * Steps; |
|
76 |
||
77 |
for i:= 0 to Steps - 1 do |
|
78 |
begin |
|
79 |
if hwRound(Gear^.Y) > LAND_HEIGHT-1184 then // TODO - configure in theme |
|
80 |
Gear^.dY:= Gear^.dY - _1div50000 |
|
81 |
else |
|
82 |
Gear^.dY:= Gear^.dY + _1div50000; |
|
83 |
||
84 |
Gear^.Y:= Gear^.Y + Gear^.dY |
|
85 |
end; |
|
86 |
||
87 |
if hwRound(Gear^.X) < -cScreenWidth - 256 then Gear^.X:= int2hwFloat(cScreenWidth + LAND_WIDTH) else |
|
88 |
if hwRound(Gear^.X) > cScreenWidth + LAND_WIDTH then Gear^.X:= int2hwFloat(-cScreenWidth - 256) |
|
89 |
end; |
|
90 |
||
91 |
//////////////////////////////////////////////////////////////////////////////// |
|
92 |
procedure doStepExpl(Gear: PVisualGear; Steps: Longword); |
|
93 |
begin |
|
94 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
95 |
||
96 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
97 |
//Gear^.dY:= Gear^.dY + cGravity; |
|
98 |
||
99 |
if Gear^.FrameTicks <= Steps then |
|
100 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
101 |
else |
|
102 |
begin |
|
103 |
dec(Gear^.Frame); |
|
104 |
Gear^.FrameTicks:= cExplFrameTicks |
|
105 |
end |
|
106 |
else dec(Gear^.FrameTicks, Steps) |
|
107 |
end; |
|
108 |
||
109 |
//////////////////////////////////////////////////////////////////////////////// |
|
110 |
procedure doStepEgg(Gear: PVisualGear; Steps: Longword); |
|
111 |
begin |
|
112 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
113 |
||
114 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
115 |
Gear^.dY:= Gear^.dY + cGravity * Steps; |
|
116 |
||
117 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
118 |
||
119 |
if Gear^.FrameTicks <= Steps then |
|
120 |
DeleteVisualGear(Gear) |
|
121 |
else |
|
122 |
dec(Gear^.FrameTicks, Steps) |
|
123 |
end; |
|
124 |
||
125 |
//////////////////////////////////////////////////////////////////////////////// |
|
126 |
procedure doStepFire(Gear: PVisualGear; Steps: Longword); |
|
127 |
begin |
|
128 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
129 |
||
130 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravity * (Steps * Steps); |
|
131 |
Gear^.dY:= Gear^.dY + cGravity * Steps; |
|
132 |
||
133 |
if Gear^.FrameTicks <= Steps then |
|
134 |
DeleteVisualGear(Gear) |
|
135 |
else |
|
136 |
dec(Gear^.FrameTicks, Steps) |
|
137 |
end; |
|
138 |
||
139 |
//////////////////////////////////////////////////////////////////////////////// |
|
140 |
procedure doStepShell(Gear: PVisualGear; Steps: Longword); |
|
141 |
begin |
|
142 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
143 |
||
144 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
145 |
Gear^.dY:= Gear^.dY + cGravity * Steps; |
|
146 |
||
147 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
148 |
||
149 |
if Gear^.FrameTicks <= Steps then |
|
150 |
DeleteVisualGear(Gear) |
|
151 |
else |
|
152 |
dec(Gear^.FrameTicks, Steps) |
|
153 |
end; |
|
154 |
||
155 |
procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword); |
|
156 |
begin |
|
157 |
Gear^.Y:= Gear^.Y - _0_02 * Steps; |
|
158 |
||
159 |
if Gear^.FrameTicks <= Steps then |
|
160 |
DeleteVisualGear(Gear) |
|
161 |
else |
|
162 |
dec(Gear^.FrameTicks, Steps) |
|
163 |
end; |
|
164 |
||
165 |
//////////////////////////////////////////////////////////////////////////////// |
|
166 |
procedure doStepBubble(Gear: PVisualGear; Steps: Longword); |
|
167 |
begin |
|
168 |
Gear^.X:= Gear^.X + (cWindSpeed * 100 + Gear^.dX) * Steps; |
|
169 |
Gear^.Y:= Gear^.Y - cDrownSpeed * Steps; |
|
170 |
||
171 |
if (Gear^.FrameTicks <= Steps) or (hwRound(Gear^.Y) < cWaterLine) then |
|
172 |
DeleteVisualGear(Gear) |
|
173 |
else |
|
174 |
dec(Gear^.FrameTicks, Steps) |
|
175 |
end; |
|
176 |
||
177 |
//////////////////////////////////////////////////////////////////////////////// |
|
178 |
procedure doStepHealth(Gear: PVisualGear; Steps: Longword); |
|
179 |
begin |
|
180 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
181 |
Gear^.Y:= Gear^.Y - Gear^.dY * Steps; |
|
182 |
||
183 |
if Gear^.FrameTicks <= Steps then |
|
184 |
DeleteVisualGear(Gear) |
|
185 |
else |
|
186 |
dec(Gear^.FrameTicks, Steps); |
|
187 |
end; |
|
188 |
||
189 |
//////////////////////////////////////////////////////////////////////////////// |
|
190 |
procedure doStepSteam(Gear: PVisualGear; Steps: Longword); |
|
191 |
begin |
|
192 |
Gear^.X:= Gear^.X + (cWindSpeed * 100 + Gear^.dX) * Steps; |
|
193 |
Gear^.Y:= Gear^.Y - cDrownSpeed * Steps; |
|
194 |
||
195 |
if Gear^.FrameTicks <= Steps then |
|
196 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
197 |
else |
|
198 |
begin |
|
199 |
if Random(2) = 0 then dec(Gear^.Frame); |
|
200 |
Gear^.FrameTicks:= cExplFrameTicks |
|
201 |
end |
|
202 |
else dec(Gear^.FrameTicks, Steps) |
|
203 |
end; |
|
204 |
||
205 |
//////////////////////////////////////////////////////////////////////////////// |
|
206 |
procedure doStepAmmo(Gear: PVisualGear; Steps: Longword); |
|
207 |
begin |
|
208 |
Gear^.Y:= Gear^.Y - cDrownSpeed * Steps; |
|
209 |
||
210 |
Gear^.scale:= Gear^.scale + 0.0025 * Steps; |
|
211 |
Gear^.alpha:= Gear^.alpha - 0.0015 * Steps; |
|
212 |
||
213 |
if Gear^.alpha < 0 then DeleteVisualGear(Gear) |
|
214 |
end; |
|
215 |
||
216 |
//////////////////////////////////////////////////////////////////////////////// |
|
217 |
procedure doStepSmoke(Gear: PVisualGear; Steps: Longword); |
|
218 |
begin |
|
219 |
Gear^.X:= Gear^.X + (cWindSpeed + Gear^.dX) * Steps; |
|
220 |
Gear^.Y:= Gear^.Y - (cDrownSpeed + Gear^.dY) * Steps; |
|
221 |
||
222 |
Gear^.dX := Gear^.dX + (cWindSpeed * _0_3 * Steps); |
|
223 |
//Gear^.dY := Gear^.dY - (cDrownSpeed * _0_995); |
|
224 |
||
225 |
if Gear^.FrameTicks <= Steps then |
|
226 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
227 |
else |
|
228 |
begin |
|
229 |
if Random(2) = 0 then dec(Gear^.Frame); |
|
230 |
Gear^.FrameTicks:= cExplFrameTicks |
|
231 |
end |
|
232 |
else dec(Gear^.FrameTicks, Steps) |
|
233 |
end; |
|
234 |
||
235 |
//////////////////////////////////////////////////////////////////////////////// |
|
236 |
procedure doStepDust(Gear: PVisualGear; Steps: Longword); |
|
237 |
begin |
|
238 |
Gear^.X:= Gear^.X + (cWindSpeed + (cWindSpeed * _0_03 * Steps) + Gear^.dX) * Steps; |
|
239 |
Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps; |
|
240 |
||
241 |
Gear^.dX := Gear^.dX - (Gear^.dX * _0_005 * Steps); |
|
242 |
Gear^.dY := Gear^.dY - (cDrownSpeed * _0_001 * Steps); |
|
243 |
||
244 |
if Gear^.FrameTicks <= Steps then |
|
245 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
246 |
else |
|
247 |
begin |
|
248 |
dec(Gear^.Frame); |
|
249 |
Gear^.FrameTicks:= cExplFrameTicks |
|
250 |
end |
|
251 |
else dec(Gear^.FrameTicks, Steps) |
|
252 |
end; |
|
253 |
||
254 |
//////////////////////////////////////////////////////////////////////////////// |
|
255 |
procedure doStepSplash(Gear: PVisualGear; Steps: Longword); |
|
256 |
begin |
|
257 |
if Gear^.FrameTicks <= Steps then |
|
258 |
DeleteVisualGear(Gear) |
|
259 |
else |
|
260 |
dec(Gear^.FrameTicks, Steps); |
|
261 |
end; |
|
262 |
||
263 |
//////////////////////////////////////////////////////////////////////////////// |
|
264 |
procedure doStepDroplet(Gear: PVisualGear; Steps: Longword); |
|
265 |
begin |
|
266 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
267 |
||
268 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
269 |
Gear^.dY:= Gear^.dY + cGravity * Steps; |
|
270 |
||
271 |
if hwRound(Gear^.Y) > cWaterLine then begin |
|
272 |
DeleteVisualGear(Gear); |
|
273 |
PlaySound(TSound(ord(sndDroplet1) + Random(3))); |
|
274 |
end; |
|
275 |
end; |
|
276 |
||
277 |
//////////////////////////////////////////////////////////////////////////////// |
|
278 |
procedure doStepSmokeRing(Gear: PVisualGear; Steps: Longword); |
|
279 |
begin |
|
280 |
inc(Gear^.Timer, Steps); |
|
281 |
if Gear^.Timer >= Gear^.FrameTicks then DeleteVisualGear(Gear) |
|
282 |
else |
|
283 |
begin |
|
284 |
Gear^.scale := 1.25 * (-power(2, -10 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4; |
|
285 |
Gear^.alpha := 1 - power(Gear^.Timer / 350, 4); |
|
286 |
if Gear^.alpha < 0 then Gear^.alpha:= 0; |
|
287 |
end; |
|
288 |
end; |
|
289 |
||
290 |
//////////////////////////////////////////////////////////////////////////////// |
|
291 |
procedure doStepFeather(Gear: PVisualGear; Steps: Longword); |
|
292 |
begin |
|
293 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
294 |
||
295 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
296 |
Gear^.dY:= Gear^.dY + cGravity * Steps; |
|
297 |
||
298 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
299 |
||
300 |
if Gear^.FrameTicks <= Steps then |
|
301 |
DeleteVisualGear(Gear) |
|
302 |
else |
|
303 |
dec(Gear^.FrameTicks, Steps) |
|
304 |
end; |
|
305 |
||
306 |
//////////////////////////////////////////////////////////////////////////////// |
|
307 |
const cSorterWorkTime = 640; |
|
308 |
var thexchar: array[0..cMaxTeams] of |
|
309 |
record |
|
310 |
dy, ny, dw: LongInt; |
|
311 |
team: PTeam; |
|
312 |
SortFactor: QWord; |
|
313 |
end; |
|
314 |
currsorter: PVisualGear = nil; |
|
315 |
||
316 |
procedure doStepTeamHealthSorterWork(Gear: PVisualGear; Steps: Longword); |
|
317 |
var i, t: LongInt; |
|
318 |
begin |
|
319 |
for t:= 1 to Steps do |
|
320 |
begin |
|
321 |
dec(Gear^.Timer); |
|
322 |
if (Gear^.Timer and 15) = 0 then |
|
323 |
for i:= 0 to Pred(TeamsCount) do |
|
324 |
with thexchar[i] do |
|
325 |
begin |
|
326 |
{$WARNINGS OFF} |
|
327 |
team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer) div 640; |
|
328 |
team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * LongInt(Gear^.Timer) div cSorterWorkTime; |
|
329 |
{$WARNINGS ON} |
|
330 |
end; |
|
331 |
||
332 |
if (Gear^.Timer = 0) or (currsorter <> Gear) then |
|
333 |
begin |
|
334 |
if currsorter = Gear then currsorter:= nil; |
|
335 |
DeleteVisualGear(Gear); |
|
336 |
exit |
|
337 |
end |
|
338 |
end |
|
339 |
end; |
|
340 |
||
341 |
procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword); |
|
342 |
var i: Longword; |
|
343 |
b: boolean; |
|
344 |
t: LongInt; |
|
345 |
begin |
|
346 |
Steps:= Steps; // avoid compiler hint |
|
347 |
for t:= 0 to Pred(TeamsCount) do |
|
348 |
with thexchar[t] do |
|
349 |
begin |
|
350 |
dy:= TeamsArray[t]^.DrawHealthY; |
|
351 |
dw:= TeamsArray[t]^.TeamHealthBarWidth - TeamsArray[t]^.NewTeamHealthBarWidth; |
|
352 |
team:= TeamsArray[t]; |
|
353 |
SortFactor:= TeamsArray[t]^.Clan^.ClanHealth; |
|
354 |
SortFactor:= (SortFactor shl 3) + TeamsArray[t]^.Clan^.ClanIndex; |
|
355 |
SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth; |
|
356 |
end; |
|
357 |
||
358 |
if TeamsCount > 1 then |
|
359 |
repeat |
|
360 |
b:= true; |
|
361 |
for t:= 0 to TeamsCount - 2 do |
|
362 |
if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then |
|
363 |
begin |
|
364 |
thexchar[cMaxTeams]:= thexchar[t]; |
|
365 |
thexchar[t]:= thexchar[Succ(t)]; |
|
366 |
thexchar[Succ(t)]:= thexchar[cMaxTeams]; |
|
367 |
b:= false |
|
368 |
end |
|
369 |
until b; |
|
370 |
||
371 |
t:= - 4; |
|
372 |
for i:= 0 to Pred(TeamsCount) do |
|
373 |
with thexchar[i] do |
|
374 |
begin |
|
375 |
dec(t, team^.HealthTex^.h + 2); |
|
376 |
ny:= t; |
|
377 |
dy:= dy - ny |
|
378 |
end; |
|
379 |
||
380 |
Gear^.Timer:= cSorterWorkTime; |
|
381 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
|
382 |
currsorter:= Gear; |
|
383 |
//doStepTeamHealthSorterWork(Gear, Steps) |
|
384 |
end; |
|
385 |
||
386 |
//////////////////////////////////////////////////////////////////////////////// |
|
387 |
procedure doStepSpeechBubbleWork(Gear: PVisualGear; Steps: Longword); |
|
388 |
begin |
|
389 |
if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0; |
|
390 |
||
391 |
if (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then |
|
392 |
begin |
|
393 |
Gear^.X:= PHedgehog(Gear^.Hedgehog)^.Gear^.X + int2hwFloat(Gear^.Tex^.w div 2 - Gear^.FrameTicks); |
|
394 |
Gear^.Y:= PHedgehog(Gear^.Hedgehog)^.Gear^.Y - int2hwFloat(16 + Gear^.Tex^.h); |
|
395 |
end; |
|
396 |
||
397 |
if Gear^.Timer = 0 then |
|
398 |
begin |
|
399 |
if PHedgehog(Gear^.Hedgehog)^.SpeechGear = Gear then |
|
400 |
PHedgehog(Gear^.Hedgehog)^.SpeechGear:= nil; |
|
401 |
DeleteVisualGear(Gear) |
|
402 |
end; |
|
403 |
end; |
|
404 |
||
405 |
procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword); |
|
406 |
begin |
|
407 |
Steps:= Steps; // avoid compiler hint |
|
408 |
||
409 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
410 |
if SpeechGear <> nil then SpeechGear^.Timer:= 0; |
|
411 |
||
412 |
PHedgehog(Gear^.Hedgehog)^.SpeechGear:= Gear; |
|
413 |
||
414 |
Gear^.Timer:= max(Length(Gear^.Text) * 150, 3000); |
|
415 |
||
416 |
Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16); |
|
417 |
||
418 |
case Gear^.FrameTicks of |
|
419 |
1: Gear^.FrameTicks:= SpritesData[sprSpeechTail].Width-28; |
|
420 |
2: Gear^.FrameTicks:= SpritesData[sprThoughtTail].Width-20; |
|
421 |
3: Gear^.FrameTicks:= SpritesData[sprShoutTail].Width-10; |
|
422 |
end; |
|
423 |
||
424 |
Gear^.doStep:= @doStepSpeechBubbleWork; |
|
425 |
||
426 |
Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Tex^.h) |
|
427 |
end; |
|
428 |
||
429 |
//////////////////////////////////////////////////////////////////////////////// |
|
430 |
procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword); |
|
431 |
begin |
|
432 |
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
|
433 |
DeleteVisualGear(Gear) |
3441 | 434 |
else |
435 |
begin |
|
436 |
dec(Gear^.Timer, Steps); |
|
437 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
438 |
end; |
|
439 |
end; |
|
440 |
||
441 |
procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword); |
|
442 |
begin |
|
443 |
if hwRound(Gear^.Y) < cWaterLine + 10 then |
|
444 |
DeleteVisualGear(Gear) |
|
445 |
else |
|
446 |
Gear^.Y:= Gear^.Y - _0_08 * Steps; |
|
447 |
||
448 |
end; |
|
449 |
||
450 |
procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword); |
|
451 |
var s: shortstring; |
|
452 |
begin |
|
453 |
s:= ''; |
|
454 |
||
455 |
Gear^.dY:= -_0_08; |
|
456 |
||
457 |
str(Gear^.State, s); |
|
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
458 |
if Gear^.Hedgehog <> nil then |
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
459 |
Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16) |
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
460 |
else |
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
461 |
Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16); |
3441 | 462 |
|
463 |
if hwRound(Gear^.Y) < cWaterLine then |
|
464 |
Gear^.doStep:= @doStepHealthTagWork |
|
465 |
else |
|
466 |
Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
|
467 |
||
468 |
Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Tex^.h); |
|
469 |
||
470 |
if Steps > 1 then Gear^.doStep(Gear, Steps-1); |
|
471 |
end; |
|
472 |
||
473 |
//////////////////////////////////////////////////////////////////////////////// |
|
474 |
procedure doStepSmokeTrace(Gear: PVisualGear; Steps: Longword); |
|
475 |
var i: Longword; |
|
476 |
begin |
|
477 |
inc(Gear^.Timer, Steps ); |
|
478 |
if Gear^.Timer > 64 then |
|
479 |
begin |
|
480 |
dec(Gear^.State, Gear^.Timer div 65); |
|
481 |
Gear^.Timer:= Gear^.Timer mod 65; |
|
482 |
end; |
|
483 |
for i:= 1 to Steps do |
|
484 |
begin |
|
485 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
|
486 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
487 |
end; |
|
488 |
if Gear^.State = 0 then DeleteVisualGear(Gear); |
|
489 |
end; |
|
490 |
||
491 |
//////////////////////////////////////////////////////////////////////////////// |
|
492 |
procedure doStepExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
493 |
begin |
|
494 |
inc(Gear^.Timer, Steps); |
|
495 |
if Gear^.Timer > 75 then |
|
496 |
begin |
|
497 |
inc(Gear^.State, Gear^.Timer div 76); |
|
498 |
Gear^.Timer:= Gear^.Timer mod 76; |
|
499 |
if Gear^.State > 5 then DeleteVisualGear(Gear); |
|
500 |
end; |
|
501 |
end; |
|
502 |
||
503 |
procedure doStepExplosion(Gear: PVisualGear; Steps: Longword); |
|
504 |
var i: LongWord; |
|
505 |
begin |
|
506 |
||
507 |
for i:= 0 to 31 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFire); |
|
508 |
for i:= 0 to 8 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart); |
|
509 |
for i:= 0 to 8 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart2); |
|
510 |
Gear^.doStep:= @doStepExplosionWork; |
|
511 |
if Steps > 1 then Gear^.doStep(Gear, Steps-1); |
|
512 |
end; |
|
513 |
||
514 |
||
515 |
//////////////////////////////////////////////////////////////////////////////// |
|
516 |
procedure doStepBigExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
517 |
var maxMovement: LongInt; |
|
518 |
begin |
|
519 |
||
520 |
inc(Gear^.Timer, Steps); |
|
3466
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
521 |
(* |
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
522 |
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
|
523 |
One possible solution is, instead of using WorldDx, to use straight gl/SDL calls to jitter the screen a bit. |
3441 | 524 |
if (Gear^.Timer and 5) = 0 then |
525 |
begin |
|
526 |
maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250)); |
|
527 |
ShakeCamera(maxMovement); |
|
528 |
end; |
|
3466
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
529 |
*) |
3441 | 530 |
if Gear^.Timer > 250 then DeleteVisualGear(Gear); |
531 |
end; |
|
532 |
||
533 |
procedure doStepBigExplosion(Gear: PVisualGear; Steps: Longword); |
|
534 |
var i: LongWord; |
|
535 |
gX,gY: LongInt; |
|
536 |
begin |
|
537 |
gX:= hwRound(Gear^.X); |
|
538 |
gY:= hwRound(Gear^.Y); |
|
539 |
AddVisualGear(gX, gY, vgtSmokeRing); |
|
540 |
for i:= 0 to 46 do AddVisualGear(gX, gY, vgtFire); |
|
541 |
for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart); |
|
542 |
for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart2); |
|
543 |
Gear^.doStep:= @doStepBigExplosionWork; |
|
544 |
if Steps > 1 then Gear^.doStep(Gear, Steps-1); |
|
545 |
end; |