author | unc0rr |
Thu, 07 Apr 2011 21:43:43 +0400 | |
changeset 5119 | f475e10c4081 |
parent 4976 | 088d40d8aba2 |
child 5121 | 2d34ec60992c |
permissions | -rw-r--r-- |
3441 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
4976 | 3 |
* Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com> |
3441 | 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); |
|
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
27 |
if not SuddenDeathDmg and (FrameTicks > vobFrameTicks) then |
3441 | 28 |
begin |
29 |
dec(FrameTicks, vobFrameTicks); |
|
30 |
inc(Frame); |
|
31 |
if Frame = vobFramesCount then Frame:= 0 |
|
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
32 |
end |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
33 |
else if SuddenDeathDmg and (FrameTicks > vobSDFrameTicks) then |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
34 |
begin |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
35 |
dec(FrameTicks, vobSDFrameTicks); |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
36 |
inc(Frame); |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
37 |
if Frame = vobSDFramesCount then Frame:= 0 |
3441 | 38 |
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
|
39 |
X:= X + (cWindSpeedf * 200 + dX + tdX) * Steps; |
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
40 |
if SuddenDeathDmg then |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
41 |
Y:= Y + (dY + tdY + cGravityf * vobSDFallSpeed) * Steps |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
42 |
else |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
43 |
Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps; |
3441 | 44 |
Angle:= Angle + dAngle * Steps; |
4152
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
45 |
if Angle > 360 then |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
46 |
Angle:= Angle - 360 |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
47 |
else |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
48 |
if Angle < - 360 then |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
49 |
Angle:= Angle + 360; |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
50 |
|
3441 | 51 |
|
3764 | 52 |
if (round(X) >= cLeftScreenBorder) and |
53 |
(round(X) <= cRightScreenBorder) and |
|
4161 | 54 |
(round(Y) - 75 <= LAND_HEIGHT) and |
3441 | 55 |
(Timer > 0) and (Timer-Steps > 0) then |
56 |
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
|
57 |
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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
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
|
62 |
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
|
63 |
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
|
64 |
if ((sign < 0) and (tdY > 0)) or ((sign > 0) and (tdY < 0)) then tdY:= 0; |
3441 | 65 |
dec(Timer, Steps) |
66 |
end |
|
67 |
else |
|
68 |
begin |
|
3764 | 69 |
if round(X) < cLeftScreenBorder then X:= X + cScreenSpace else |
70 |
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
|
71 |
// 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
|
72 |
if round(Y) - 75 > LAND_HEIGHT then Y:= Y - (1024 + 150); // TODO - configure in theme (jellies for example could use limited range) |
3441 | 73 |
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
|
74 |
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
|
75 |
tdY:= 0 |
3441 | 76 |
end; |
77 |
end; |
|
78 |
||
79 |
end; |
|
80 |
||
81 |
//////////////////////////////////////////////////////////////////////////////// |
|
82 |
procedure doStepBeeTrace(Gear: PVisualGear; Steps: Longword); |
|
83 |
begin |
|
84 |
if Gear^.FrameTicks > Steps then |
|
85 |
dec(Gear^.FrameTicks, Steps) |
|
86 |
else |
|
87 |
DeleteVisualGear(Gear); |
|
88 |
end; |
|
89 |
||
90 |
//////////////////////////////////////////////////////////////////////////////// |
|
91 |
procedure doStepCloud(Gear: PVisualGear; Steps: Longword); |
|
3592
0bcad5c38c9e
clouds: up-and-down-bouncing now without evil loop
sheepluva
parents:
3590
diff
changeset
|
92 |
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
|
93 |
t: real; |
3441 | 94 |
begin |
3994
486da687d76a
fix/tweak let clouds reflect wind speed and direction again + stronger
sheepluva
parents:
3976
diff
changeset
|
95 |
Gear^.X:= Gear^.X + (cWindSpeedf * 750 * Gear^.dX) * Steps; |
3441 | 96 |
|
3592
0bcad5c38c9e
clouds: up-and-down-bouncing now without evil loop
sheepluva
parents:
3590
diff
changeset
|
97 |
// 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
|
98 |
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
|
99 |
t := 8 * AngleSin(s mod 2048).QWordValue / 4294967296; |
3597
978c30ef50fc
visual gears: fixing nemo's c-style assignment/multiplications
sheepluva
parents:
3593
diff
changeset
|
100 |
if (s < 2048) then t := -t; |
3441 | 101 |
|
4161 | 102 |
Gear^.Y := LAND_HEIGHT - 1184 + LongInt(Gear^.Timer mod 8) + t; |
3441 | 103 |
|
3764 | 104 |
if round(Gear^.X) < cLeftScreenBorder then Gear^.X:= Gear^.X + cScreenSpace else |
105 |
if round(Gear^.X) > cRightScreenBorder then Gear^.X:= Gear^.X - cScreenSpace |
|
3441 | 106 |
end; |
107 |
||
108 |
//////////////////////////////////////////////////////////////////////////////// |
|
109 |
procedure doStepExpl(Gear: PVisualGear; Steps: Longword); |
|
110 |
begin |
|
111 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
112 |
||
113 |
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
|
114 |
//Gear^.dY:= Gear^.dY + cGravityf; |
3441 | 115 |
|
116 |
if Gear^.FrameTicks <= Steps then |
|
117 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
118 |
else |
|
119 |
begin |
|
120 |
dec(Gear^.Frame); |
|
121 |
Gear^.FrameTicks:= cExplFrameTicks |
|
122 |
end |
|
123 |
else dec(Gear^.FrameTicks, Steps) |
|
124 |
end; |
|
125 |
||
126 |
//////////////////////////////////////////////////////////////////////////////// |
|
3704 | 127 |
procedure doStepNote(Gear: PVisualGear; Steps: Longword); |
128 |
begin |
|
129 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
130 |
||
131 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3706 | 132 |
Gear^.dY:= Gear^.dY + cGravityf * Steps / 2; |
3704 | 133 |
|
3706 | 134 |
Gear^.Angle:= Gear^.Angle + (Gear^.Frame + 1) * Steps / 10; |
135 |
while Gear^.Angle > cMaxAngle do |
|
136 |
Gear^.Angle:= Gear^.Angle - cMaxAngle; |
|
3704 | 137 |
|
138 |
if Gear^.FrameTicks <= Steps then |
|
139 |
DeleteVisualGear(Gear) |
|
140 |
else |
|
141 |
dec(Gear^.FrameTicks, Steps) |
|
142 |
end; |
|
143 |
||
144 |
//////////////////////////////////////////////////////////////////////////////// |
|
4279 | 145 |
procedure doStepLineTrail(Gear: PVisualGear; Steps: Longword); |
146 |
begin |
|
147 |
Steps := Steps; |
|
148 |
if Gear^.Timer <= Steps then |
|
149 |
DeleteVisualGear(Gear) |
|
150 |
else |
|
151 |
dec(Gear^.Timer, Steps) |
|
152 |
end; |
|
153 |
||
154 |
//////////////////////////////////////////////////////////////////////////////// |
|
3441 | 155 |
procedure doStepEgg(Gear: PVisualGear; Steps: Longword); |
156 |
begin |
|
157 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
158 |
||
159 |
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
|
160 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 161 |
|
162 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
163 |
||
164 |
if Gear^.FrameTicks <= Steps then |
|
165 |
DeleteVisualGear(Gear) |
|
166 |
else |
|
167 |
dec(Gear^.FrameTicks, Steps) |
|
168 |
end; |
|
169 |
||
170 |
//////////////////////////////////////////////////////////////////////////////// |
|
171 |
procedure doStepFire(Gear: PVisualGear; Steps: Longword); |
|
3751 | 172 |
var vgt: PVisualGear; |
3441 | 173 |
begin |
174 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
175 |
||
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
|
176 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravityf * (Steps * Steps); |
3751 | 177 |
if (Gear^.State and gstTmpFlag) = 0 then |
178 |
begin |
|
179 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
3764 | 180 |
if ((GameTicks mod 200) < Steps + 1) then |
3751 | 181 |
begin |
182 |
vgt:= AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtFire); |
|
183 |
if vgt <> nil then |
|
184 |
begin |
|
185 |
vgt^.dx:= 0; |
|
186 |
vgt^.dy:= 0; |
|
187 |
vgt^.State:= gstTmpFlag; |
|
188 |
end; |
|
189 |
end |
|
190 |
end |
|
191 |
else |
|
192 |
inc(Steps, Steps); |
|
3441 | 193 |
|
194 |
if Gear^.FrameTicks <= Steps then |
|
195 |
DeleteVisualGear(Gear) |
|
196 |
else |
|
197 |
dec(Gear^.FrameTicks, Steps) |
|
198 |
end; |
|
199 |
||
200 |
//////////////////////////////////////////////////////////////////////////////// |
|
201 |
procedure doStepShell(Gear: PVisualGear; Steps: Longword); |
|
202 |
begin |
|
203 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
204 |
||
205 |
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
|
206 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 207 |
|
208 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
209 |
||
210 |
if Gear^.FrameTicks <= Steps then |
|
211 |
DeleteVisualGear(Gear) |
|
212 |
else |
|
213 |
dec(Gear^.FrameTicks, Steps) |
|
214 |
end; |
|
215 |
||
216 |
procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword); |
|
217 |
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
|
218 |
Gear^.Y:= Gear^.Y - 0.02 * Steps; |
3441 | 219 |
|
220 |
if Gear^.FrameTicks <= Steps then |
|
221 |
DeleteVisualGear(Gear) |
|
222 |
else |
|
223 |
dec(Gear^.FrameTicks, Steps) |
|
224 |
end; |
|
225 |
||
226 |
//////////////////////////////////////////////////////////////////////////////// |
|
227 |
procedure doStepBubble(Gear: PVisualGear; Steps: Longword); |
|
228 |
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
|
229 |
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
|
230 |
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
|
231 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 232 |
|
4172 | 233 |
Gear^.dX := Gear^.dX / (1.001 * Steps); |
234 |
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
|
235 |
|
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
|
236 |
if (Gear^.FrameTicks <= Steps) or (round(Gear^.Y) < cWaterLine) then |
3441 | 237 |
DeleteVisualGear(Gear) |
238 |
else |
|
239 |
dec(Gear^.FrameTicks, Steps) |
|
240 |
end; |
|
241 |
||
242 |
//////////////////////////////////////////////////////////////////////////////// |
|
243 |
procedure doStepHealth(Gear: PVisualGear; Steps: Longword); |
|
244 |
begin |
|
245 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
246 |
Gear^.Y:= Gear^.Y - Gear^.dY * Steps; |
|
247 |
||
248 |
if Gear^.FrameTicks <= Steps then |
|
249 |
DeleteVisualGear(Gear) |
|
250 |
else |
|
251 |
dec(Gear^.FrameTicks, Steps); |
|
252 |
end; |
|
253 |
||
254 |
//////////////////////////////////////////////////////////////////////////////// |
|
255 |
procedure doStepSteam(Gear: PVisualGear; Steps: Longword); |
|
256 |
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
|
257 |
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
|
258 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 259 |
|
260 |
if Gear^.FrameTicks <= Steps then |
|
261 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
262 |
else |
|
263 |
begin |
|
264 |
if Random(2) = 0 then dec(Gear^.Frame); |
|
265 |
Gear^.FrameTicks:= cExplFrameTicks |
|
266 |
end |
|
267 |
else dec(Gear^.FrameTicks, Steps) |
|
268 |
end; |
|
269 |
||
270 |
//////////////////////////////////////////////////////////////////////////////// |
|
271 |
procedure doStepAmmo(Gear: PVisualGear; Steps: Longword); |
|
272 |
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
|
273 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 274 |
|
275 |
Gear^.scale:= Gear^.scale + 0.0025 * Steps; |
|
276 |
Gear^.alpha:= Gear^.alpha - 0.0015 * Steps; |
|
277 |
||
278 |
if Gear^.alpha < 0 then DeleteVisualGear(Gear) |
|
279 |
end; |
|
280 |
||
281 |
//////////////////////////////////////////////////////////////////////////////// |
|
282 |
procedure doStepSmoke(Gear: PVisualGear; Steps: Longword); |
|
283 |
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
|
284 |
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
|
285 |
Gear^.Y:= Gear^.Y - (cDrownSpeedf + Gear^.dY) * Steps; |
3441 | 286 |
|
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
|
287 |
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
|
288 |
//Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.995); |
3441 | 289 |
|
290 |
if Gear^.FrameTicks <= Steps then |
|
291 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
292 |
else |
|
293 |
begin |
|
294 |
if Random(2) = 0 then dec(Gear^.Frame); |
|
295 |
Gear^.FrameTicks:= cExplFrameTicks |
|
296 |
end |
|
297 |
else dec(Gear^.FrameTicks, Steps) |
|
298 |
end; |
|
299 |
||
300 |
//////////////////////////////////////////////////////////////////////////////// |
|
301 |
procedure doStepDust(Gear: PVisualGear; Steps: Longword); |
|
302 |
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
|
303 |
Gear^.X:= Gear^.X + (cWindSpeedf + (cWindSpeedf * 0.03 * Steps) + Gear^.dX) * Steps; |
3441 | 304 |
Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps; |
305 |
||
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
|
306 |
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
|
307 |
Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.001 * Steps); |
3441 | 308 |
|
309 |
if Gear^.FrameTicks <= Steps then |
|
310 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
311 |
else |
|
312 |
begin |
|
313 |
dec(Gear^.Frame); |
|
314 |
Gear^.FrameTicks:= cExplFrameTicks |
|
315 |
end |
|
316 |
else dec(Gear^.FrameTicks, Steps) |
|
317 |
end; |
|
318 |
||
319 |
//////////////////////////////////////////////////////////////////////////////// |
|
320 |
procedure doStepSplash(Gear: PVisualGear; Steps: Longword); |
|
321 |
begin |
|
322 |
if Gear^.FrameTicks <= Steps then |
|
323 |
DeleteVisualGear(Gear) |
|
324 |
else |
|
325 |
dec(Gear^.FrameTicks, Steps); |
|
326 |
end; |
|
327 |
||
328 |
//////////////////////////////////////////////////////////////////////////////// |
|
329 |
procedure doStepDroplet(Gear: PVisualGear; Steps: Longword); |
|
330 |
begin |
|
331 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
332 |
||
333 |
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
|
334 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 335 |
|
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
|
336 |
if round(Gear^.Y) > cWaterLine then begin |
3441 | 337 |
DeleteVisualGear(Gear); |
338 |
PlaySound(TSound(ord(sndDroplet1) + Random(3))); |
|
339 |
end; |
|
340 |
end; |
|
341 |
||
342 |
//////////////////////////////////////////////////////////////////////////////// |
|
343 |
procedure doStepSmokeRing(Gear: PVisualGear; Steps: Longword); |
|
344 |
begin |
|
345 |
inc(Gear^.Timer, Steps); |
|
346 |
if Gear^.Timer >= Gear^.FrameTicks then DeleteVisualGear(Gear) |
|
347 |
else |
|
348 |
begin |
|
349 |
Gear^.scale := 1.25 * (-power(2, -10 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4; |
|
350 |
Gear^.alpha := 1 - power(Gear^.Timer / 350, 4); |
|
351 |
if Gear^.alpha < 0 then Gear^.alpha:= 0; |
|
352 |
end; |
|
353 |
end; |
|
354 |
||
355 |
//////////////////////////////////////////////////////////////////////////////// |
|
356 |
procedure doStepFeather(Gear: PVisualGear; Steps: Longword); |
|
357 |
begin |
|
358 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
359 |
||
360 |
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
|
361 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 362 |
|
363 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
364 |
||
365 |
if Gear^.FrameTicks <= Steps then |
|
366 |
DeleteVisualGear(Gear) |
|
367 |
else |
|
368 |
dec(Gear^.FrameTicks, Steps) |
|
369 |
end; |
|
370 |
||
371 |
//////////////////////////////////////////////////////////////////////////////// |
|
372 |
const cSorterWorkTime = 640; |
|
373 |
var thexchar: array[0..cMaxTeams] of |
|
374 |
record |
|
375 |
dy, ny, dw: LongInt; |
|
376 |
team: PTeam; |
|
377 |
SortFactor: QWord; |
|
378 |
end; |
|
379 |
currsorter: PVisualGear = nil; |
|
380 |
||
381 |
procedure doStepTeamHealthSorterWork(Gear: PVisualGear; Steps: Longword); |
|
382 |
var i, t: LongInt; |
|
383 |
begin |
|
384 |
for t:= 1 to Steps do |
|
385 |
begin |
|
386 |
dec(Gear^.Timer); |
|
387 |
if (Gear^.Timer and 15) = 0 then |
|
388 |
for i:= 0 to Pred(TeamsCount) do |
|
389 |
with thexchar[i] do |
|
390 |
begin |
|
391 |
{$WARNINGS OFF} |
|
392 |
team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer) div 640; |
|
393 |
team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * LongInt(Gear^.Timer) div cSorterWorkTime; |
|
394 |
{$WARNINGS ON} |
|
395 |
end; |
|
396 |
||
397 |
if (Gear^.Timer = 0) or (currsorter <> Gear) then |
|
398 |
begin |
|
399 |
if currsorter = Gear then currsorter:= nil; |
|
400 |
DeleteVisualGear(Gear); |
|
401 |
exit |
|
402 |
end |
|
403 |
end |
|
404 |
end; |
|
405 |
||
406 |
procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword); |
|
407 |
var i: Longword; |
|
408 |
b: boolean; |
|
409 |
t: LongInt; |
|
410 |
begin |
|
411 |
Steps:= Steps; // avoid compiler hint |
|
412 |
for t:= 0 to Pred(TeamsCount) do |
|
413 |
with thexchar[t] do |
|
414 |
begin |
|
415 |
dy:= TeamsArray[t]^.DrawHealthY; |
|
416 |
dw:= TeamsArray[t]^.TeamHealthBarWidth - TeamsArray[t]^.NewTeamHealthBarWidth; |
|
417 |
team:= TeamsArray[t]; |
|
418 |
SortFactor:= TeamsArray[t]^.Clan^.ClanHealth; |
|
419 |
SortFactor:= (SortFactor shl 3) + TeamsArray[t]^.Clan^.ClanIndex; |
|
420 |
SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth; |
|
421 |
end; |
|
422 |
||
423 |
if TeamsCount > 1 then |
|
424 |
repeat |
|
425 |
b:= true; |
|
426 |
for t:= 0 to TeamsCount - 2 do |
|
427 |
if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then |
|
428 |
begin |
|
429 |
thexchar[cMaxTeams]:= thexchar[t]; |
|
430 |
thexchar[t]:= thexchar[Succ(t)]; |
|
431 |
thexchar[Succ(t)]:= thexchar[cMaxTeams]; |
|
432 |
b:= false |
|
433 |
end |
|
434 |
until b; |
|
435 |
||
436 |
t:= - 4; |
|
437 |
for i:= 0 to Pred(TeamsCount) do |
|
438 |
with thexchar[i] do |
|
439 |
begin |
|
440 |
dec(t, team^.HealthTex^.h + 2); |
|
441 |
ny:= t; |
|
442 |
dy:= dy - ny |
|
443 |
end; |
|
444 |
||
445 |
Gear^.Timer:= cSorterWorkTime; |
|
446 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
|
447 |
currsorter:= Gear; |
|
448 |
//doStepTeamHealthSorterWork(Gear, Steps) |
|
449 |
end; |
|
450 |
||
451 |
//////////////////////////////////////////////////////////////////////////////// |
|
452 |
procedure doStepSpeechBubbleWork(Gear: PVisualGear; Steps: Longword); |
|
453 |
begin |
|
454 |
if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0; |
|
455 |
||
4365 | 456 |
if (Gear^.Hedgehog^.Gear <> nil) then |
3441 | 457 |
begin |
4365 | 458 |
Gear^.X:= Gear^.Hedgehog^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2 - Gear^.FrameTicks); |
459 |
Gear^.Y:= Gear^.Hedgehog^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h); |
|
3441 | 460 |
end; |
461 |
||
462 |
if Gear^.Timer = 0 then |
|
463 |
begin |
|
4365 | 464 |
if Gear^.Hedgehog^.SpeechGear = Gear then |
465 |
Gear^.Hedgehog^.SpeechGear:= nil; |
|
3441 | 466 |
DeleteVisualGear(Gear) |
467 |
end; |
|
468 |
end; |
|
469 |
||
470 |
procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword); |
|
471 |
begin |
|
472 |
Steps:= Steps; // avoid compiler hint |
|
473 |
||
4365 | 474 |
with Gear^.Hedgehog^ do |
3441 | 475 |
if SpeechGear <> nil then SpeechGear^.Timer:= 0; |
476 |
||
4365 | 477 |
Gear^.Hedgehog^.SpeechGear:= Gear; |
3441 | 478 |
|
479 |
Gear^.Timer:= max(Length(Gear^.Text) * 150, 3000); |
|
480 |
||
481 |
Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16); |
|
482 |
||
483 |
case Gear^.FrameTicks of |
|
484 |
1: Gear^.FrameTicks:= SpritesData[sprSpeechTail].Width-28; |
|
485 |
2: Gear^.FrameTicks:= SpritesData[sprThoughtTail].Width-20; |
|
486 |
3: Gear^.FrameTicks:= SpritesData[sprShoutTail].Width-10; |
|
487 |
end; |
|
488 |
||
489 |
Gear^.doStep:= @doStepSpeechBubbleWork; |
|
490 |
||
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
|
491 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h |
3441 | 492 |
end; |
493 |
||
494 |
//////////////////////////////////////////////////////////////////////////////// |
|
495 |
procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword); |
|
496 |
begin |
|
497 |
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
|
498 |
DeleteVisualGear(Gear) |
3441 | 499 |
else |
500 |
begin |
|
501 |
dec(Gear^.Timer, Steps); |
|
502 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
503 |
end; |
|
504 |
end; |
|
505 |
||
506 |
procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword); |
|
507 |
begin |
|
4161 | 508 |
if round(Gear^.Y) - 10 < cWaterLine then |
3441 | 509 |
DeleteVisualGear(Gear) |
510 |
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
|
511 |
Gear^.Y:= Gear^.Y - 0.08 * Steps; |
3441 | 512 |
|
513 |
end; |
|
514 |
||
515 |
procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword); |
|
516 |
var s: shortstring; |
|
517 |
begin |
|
518 |
s:= ''; |
|
519 |
||
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
|
520 |
Gear^.dY:= -0.08; |
3441 | 521 |
|
522 |
str(Gear^.State, s); |
|
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
523 |
if Gear^.Hedgehog <> nil then |
4365 | 524 |
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
|
525 |
else |
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
526 |
Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16); |
3441 | 527 |
|
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
|
528 |
if round(Gear^.Y) < cWaterLine then |
3441 | 529 |
Gear^.doStep:= @doStepHealthTagWork |
530 |
else |
|
531 |
Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
|
532 |
||
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
|
533 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h; |
3441 | 534 |
|
535 |
if Steps > 1 then Gear^.doStep(Gear, Steps-1); |
|
536 |
end; |
|
537 |
||
538 |
//////////////////////////////////////////////////////////////////////////////// |
|
539 |
procedure doStepSmokeTrace(Gear: PVisualGear; Steps: Longword); |
|
540 |
begin |
|
541 |
inc(Gear^.Timer, Steps ); |
|
542 |
if Gear^.Timer > 64 then |
|
543 |
begin |
|
3995
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
544 |
if Gear^.State = 0 then |
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
545 |
begin |
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
546 |
DeleteVisualGear(Gear); |
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
547 |
exit; |
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
548 |
end; |
3441 | 549 |
dec(Gear^.State, Gear^.Timer div 65); |
550 |
Gear^.Timer:= Gear^.Timer mod 65; |
|
551 |
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
|
552 |
Gear^.dX:= Gear^.dX + cWindSpeedf * Steps; |
3587 | 553 |
Gear^.X:= Gear^.X + Gear^.dX; |
3441 | 554 |
end; |
555 |
||
556 |
//////////////////////////////////////////////////////////////////////////////// |
|
557 |
procedure doStepExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
558 |
begin |
|
559 |
inc(Gear^.Timer, Steps); |
|
560 |
if Gear^.Timer > 75 then |
|
561 |
begin |
|
562 |
inc(Gear^.State, Gear^.Timer div 76); |
|
563 |
Gear^.Timer:= Gear^.Timer mod 76; |
|
564 |
if Gear^.State > 5 then DeleteVisualGear(Gear); |
|
565 |
end; |
|
566 |
end; |
|
567 |
||
568 |
procedure doStepExplosion(Gear: PVisualGear; Steps: Longword); |
|
569 |
var i: LongWord; |
|
4473 | 570 |
gX,gY: LongInt; |
571 |
vg: PVisualGear; |
|
3441 | 572 |
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
|
573 |
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
|
574 |
gY:= round(Gear^.Y); |
4473 | 575 |
for i:= 0 to 31 do |
576 |
begin |
|
577 |
vg:= AddVisualGear(gX, gY, vgtFire); |
|
4475
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
578 |
if vg <> nil then |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
579 |
begin |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
580 |
vg^.State:= gstTmpFlag; |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
581 |
inc(vg^.FrameTicks, vg^.FrameTicks) |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
582 |
end |
4473 | 583 |
end; |
3590 | 584 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart); |
585 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart2); |
|
3441 | 586 |
Gear^.doStep:= @doStepExplosionWork; |
587 |
if Steps > 1 then Gear^.doStep(Gear, Steps-1); |
|
588 |
end; |
|
589 |
||
590 |
||
591 |
//////////////////////////////////////////////////////////////////////////////// |
|
592 |
procedure doStepBigExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
3587 | 593 |
//var maxMovement: LongInt; |
3441 | 594 |
begin |
595 |
||
596 |
inc(Gear^.Timer, Steps); |
|
3466
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
597 |
(* |
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
598 |
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
|
599 |
One possible solution is, instead of using WorldDx, to use straight gl/SDL calls to jitter the screen a bit. |
3441 | 600 |
if (Gear^.Timer and 5) = 0 then |
601 |
begin |
|
602 |
maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250)); |
|
603 |
ShakeCamera(maxMovement); |
|
604 |
end; |
|
3466
78d9fa9a700e
Comment out the desyncing block, with a suggestion for possible fix
nemo
parents:
3459
diff
changeset
|
605 |
*) |
3441 | 606 |
if Gear^.Timer > 250 then DeleteVisualGear(Gear); |
607 |
end; |
|
608 |
||
609 |
procedure doStepBigExplosion(Gear: PVisualGear; Steps: Longword); |
|
610 |
var i: LongWord; |
|
4473 | 611 |
gX,gY: LongInt; |
612 |
vg: PVisualGear; |
|
3441 | 613 |
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
|
614 |
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
|
615 |
gY:= round(Gear^.Y); |
3441 | 616 |
AddVisualGear(gX, gY, vgtSmokeRing); |
4473 | 617 |
for i:= 0 to 46 do |
618 |
begin |
|
619 |
vg:= AddVisualGear(gX, gY, vgtFire); |
|
4475
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
620 |
if vg <> nil then |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
621 |
begin |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
622 |
vg^.State:= gstTmpFlag; |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
623 |
inc(vg^.FrameTicks, vg^.FrameTicks) |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
624 |
end |
4473 | 625 |
end; |
3441 | 626 |
for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart); |
627 |
for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart2); |
|
628 |
Gear^.doStep:= @doStepBigExplosionWork; |
|
629 |
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
|
630 |
performRumble(); |
3441 | 631 |
end; |
3689 | 632 |
|
633 |
procedure doStepChunk(Gear: PVisualGear; Steps: Longword); |
|
634 |
begin |
|
635 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
636 |
||
637 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
638 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
639 |
||
640 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
641 |
||
642 |
if round(Gear^.Y) > cWaterLine then |
|
643 |
begin |
|
3699 | 644 |
AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtDroplet); |
3689 | 645 |
DeleteVisualGear(Gear); |
646 |
end |
|
647 |
end; |
|
4327 | 648 |
|
649 |
//////////////////////////////////////////////////////////////////////////////// |
|
650 |
procedure doStepBulletHit(Gear: PVisualGear; Steps: Longword); |
|
651 |
begin |
|
652 |
if Gear^.FrameTicks <= Steps then |
|
653 |
DeleteVisualGear(Gear) |
|
654 |
else |
|
655 |
dec(Gear^.FrameTicks, Steps); |
|
656 |
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
|
657 |
|
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
|
658 |
//////////////////////////////////////////////////////////////////////////////// |
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
|
659 |
procedure doStepCircle(Gear: PVisualGear; Steps: Longword); |
4452 | 660 |
var tmp: LongInt; |
4421 | 661 |
i: LongWord; |
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
|
662 |
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
|
663 |
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
|
664 |
if Frame <> 0 then |
4421 | 665 |
for i:= 1 to Steps do |
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
|
666 |
begin |
4421 | 667 |
inc(FrameTicks); |
668 |
if (FrameTicks mod Frame) = 0 then |
|
669 |
begin |
|
670 |
tmp:= Gear^.Tint and $FF; |
|
671 |
if tdY >= 0 then inc(tmp) |
|
672 |
else dec(tmp); |
|
673 |
if tmp < round(dX) then tdY:= 1; |
|
674 |
if tmp > round(dY) then tdY:= -1; |
|
4838
6c2528fe925d
Force a bunch of images to RGBA that were either RGB or indexed, strip
nemo
parents:
4806
diff
changeset
|
675 |
if tmp > 255 then tmp := 255; |
6c2528fe925d
Force a bunch of images to RGBA that were either RGB or indexed, strip
nemo
parents:
4806
diff
changeset
|
676 |
if tmp < 0 then tmp := 0; |
4421 | 677 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or tmp |
678 |
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
|
679 |
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
|
680 |
end; |