author | Wuzzy <Wuzzy2@mail.ru> |
Thu, 08 Feb 2018 09:26:24 +0100 | |
changeset 12924 | 48b9f15859b0 |
parent 12110 | f214d6315b71 |
child 13040 | a87d3119c962 |
permissions | -rw-r--r-- |
9287 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
9287 | 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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
10015
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
9287 | 17 |
*) |
18 |
||
19 |
{$INCLUDE "options.inc"} |
|
20 |
||
21 |
unit uVisualGearsList; |
|
22 |
interface |
|
23 |
uses uTypes; |
|
24 |
||
25 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline; |
|
26 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline; |
|
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
27 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline; |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
28 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear; |
9287 | 29 |
procedure DeleteVisualGear(Gear: PVisualGear); |
30 |
function VisualGearByUID(uid : Longword) : PVisualGear; |
|
31 |
||
10015 | 32 |
const |
9287 | 33 |
cExplFrameTicks = 110; |
34 |
||
35 |
var VGCounter: LongWord; |
|
36 |
VisualGearLayers: array[0..6] of PVisualGear; |
|
37 |
||
38 |
implementation |
|
11880
2eac7a96b342
Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents:
11857
diff
changeset
|
39 |
uses uCollisions, uFloat, uVariables, uConsts, uTextures, uVisualGearsHandlers, uScript; |
9287 | 40 |
|
41 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline; |
|
42 |
begin |
|
10352 | 43 |
// adjust some visual gear types if underwater |
10354 | 44 |
if CheckCoordInWater(X, Y) and ((Kind = vgtBeeTrace) or (Kind = vgtSmokeTrace) or (Kind = vgtEvilTrace)) then |
10352 | 45 |
Kind:= vgtBubble; |
46 |
||
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
47 |
AddVisualGear:= AddVisualGear(X, Y, Kind, 0, false, -1); |
9287 | 48 |
end; |
49 |
||
50 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline; |
|
51 |
begin |
|
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
52 |
AddVisualGear:= AddVisualGear(X, Y, Kind, State, false, -1); |
9287 | 53 |
end; |
54 |
||
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
55 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline; |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
56 |
begin |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
57 |
AddVisualGear:= AddVisualGear(X, Y, Kind, State, Critical, -1); |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
58 |
end; |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
59 |
|
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
60 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear; |
9287 | 61 |
var gear: PVisualGear; |
62 |
t: Longword; |
|
63 |
sp: real; |
|
64 |
begin |
|
65 |
AddVisualGear:= nil; |
|
66 |
if ((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) or fastScrolling) and // we are scrolling now |
|
67 |
((Kind <> vgtCloud) and (not Critical)) then |
|
68 |
exit; |
|
69 |
||
70 |
if ((cReducedQuality and rqAntiBoom) <> 0) and |
|
71 |
(not Critical) and |
|
72 |
(not (Kind in |
|
73 |
[vgtTeamHealthSorter, |
|
74 |
vgtSmallDamageTag, |
|
75 |
vgtSpeechBubble, |
|
76 |
vgtHealthTag, |
|
77 |
vgtExplosion, |
|
78 |
vgtSmokeTrace, |
|
79 |
vgtEvilTrace, |
|
80 |
vgtNote, |
|
10876 | 81 |
vgtFeather, |
9287 | 82 |
vgtSmoothWindBar])) then |
10015 | 83 |
|
9287 | 84 |
exit; |
85 |
||
86 |
inc(VGCounter); |
|
87 |
New(gear); |
|
88 |
FillChar(gear^, sizeof(TVisualGear), 0); |
|
89 |
gear^.X:= real(X); |
|
90 |
gear^.Y:= real(Y); |
|
91 |
gear^.Kind := Kind; |
|
9960 | 92 |
gear^.doStep:= doStepVGHandlers[Kind]; |
9287 | 93 |
gear^.Tint:= $FFFFFFFF; |
94 |
gear^.uid:= VGCounter; |
|
95 |
||
96 |
with gear^ do |
|
97 |
case Kind of |
|
98 |
vgtFlake: |
|
99 |
begin |
|
100 |
Timer:= 0; |
|
101 |
tdX:= 0; |
|
102 |
tdY:= 0; |
|
103 |
Scale:= 1.0; |
|
104 |
if SuddenDeathDmg then |
|
105 |
begin |
|
10625
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10354
diff
changeset
|
106 |
if vobSDFrameTicks > 0 then |
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10354
diff
changeset
|
107 |
FrameTicks:= random(vobSDFrameTicks); |
9287 | 108 |
Frame:= random(vobSDFramesCount); |
109 |
end |
|
110 |
else |
|
111 |
begin |
|
10625
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10354
diff
changeset
|
112 |
if vobFrameTicks > 0 then |
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10354
diff
changeset
|
113 |
FrameTicks:= random(vobFrameTicks); |
9287 | 114 |
Frame:= random(vobFramesCount); |
115 |
end; |
|
116 |
Angle:= random(360); |
|
117 |
dx:= 0.0000038654705 * random(10000); |
|
118 |
dy:= 0.000003506096 * random(7000); |
|
119 |
if random(2) = 0 then |
|
120 |
dx := -dx; |
|
121 |
if SuddenDeathDmg then |
|
122 |
dAngle:= (random(2) * 2 - 1) * (vobSDVelocity + random(vobSDVelocity)) / 1000 |
|
123 |
else |
|
124 |
dAngle:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) / 1000 |
|
125 |
end; |
|
126 |
vgtCloud: |
|
127 |
begin |
|
128 |
Frame:= random(4); |
|
129 |
dx:= 0.5 + 0.1 * random(5); // how much the cloud will be affected by wind |
|
130 |
timer:= random(4096); |
|
131 |
Scale:= 1.0 |
|
132 |
end; |
|
133 |
vgtExplPart, |
|
134 |
vgtExplPart2: |
|
135 |
begin |
|
136 |
t:= random(1024); |
|
137 |
sp:= 0.001 * (random(95) + 70); |
|
138 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
139 |
dy:= hwFloat2Float(AngleCos(t)) * sp; |
|
140 |
if random(2) = 0 then |
|
141 |
dx := -dx; |
|
142 |
if random(2) = 0 then |
|
143 |
dy := -dy; |
|
144 |
Frame:= 7 - random(3); |
|
145 |
FrameTicks:= cExplFrameTicks |
|
146 |
end; |
|
147 |
vgtFire: |
|
148 |
begin |
|
149 |
t:= random(1024); |
|
150 |
sp:= 0.001 * (random(85) + 95); |
|
151 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
152 |
dy:= hwFloat2Float(AngleCos(t)) * sp; |
|
153 |
if random(2) = 0 then |
|
154 |
dx := -dx; |
|
155 |
if random(2) = 0 then |
|
156 |
dy := -dy; |
|
157 |
FrameTicks:= 650 + random(250); |
|
158 |
Frame:= random(8) |
|
159 |
end; |
|
160 |
vgtEgg: |
|
161 |
begin |
|
162 |
t:= random(1024); |
|
163 |
sp:= 0.001 * (random(85) + 95); |
|
164 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
165 |
dy:= hwFloat2Float(AngleCos(t)) * sp; |
|
166 |
if random(2) = 0 then |
|
167 |
dx := -dx; |
|
168 |
if random(2) = 0 then |
|
169 |
dy := -dy; |
|
170 |
FrameTicks:= 650 + random(250); |
|
171 |
Frame:= 1 |
|
172 |
end; |
|
173 |
vgtShell: FrameTicks:= 500; |
|
174 |
vgtSmallDamageTag: |
|
175 |
begin |
|
176 |
gear^.FrameTicks:= 1100 |
|
177 |
end; |
|
178 |
vgtBubble: |
|
179 |
begin |
|
180 |
dx:= 0.0000038654705 * random(10000); |
|
181 |
dy:= 0; |
|
182 |
if random(2) = 0 then |
|
183 |
dx := -dx; |
|
184 |
FrameTicks:= 250 + random(1751); |
|
185 |
Frame:= random(5) |
|
186 |
end; |
|
187 |
vgtSteam: |
|
188 |
begin |
|
189 |
dx:= 0.0000038654705 * random(10000); |
|
190 |
dy:= 0.001 * (random(85) + 95); |
|
191 |
if random(2) = 0 then |
|
192 |
dx := -dx; |
|
193 |
Frame:= 7 - random(3); |
|
194 |
FrameTicks:= cExplFrameTicks * 2; |
|
195 |
end; |
|
196 |
vgtAmmo: |
|
197 |
begin |
|
198 |
alpha:= 1.0; |
|
199 |
scale:= 1.0 |
|
200 |
end; |
|
201 |
vgtSmokeWhite, |
|
202 |
vgtSmoke: |
|
203 |
begin |
|
204 |
Scale:= 1.0; |
|
205 |
dx:= 0.0002 * (random(45) + 10); |
|
206 |
dy:= 0.0002 * (random(45) + 10); |
|
207 |
if random(2) = 0 then |
|
208 |
dx := -dx; |
|
209 |
Frame:= 7 - random(2); |
|
210 |
FrameTicks:= cExplFrameTicks * 2; |
|
211 |
end; |
|
212 |
vgtDust: |
|
213 |
begin |
|
214 |
dx:= 0.005 * (random(15) + 10); |
|
215 |
dy:= 0.001 * (random(40) + 20); |
|
216 |
if random(2) = 0 then dx := -dx; |
|
217 |
if random(2) = 0 then Tag:= 1 |
|
218 |
else Tag:= -1; |
|
219 |
Frame:= 7 - random(2); |
|
220 |
FrameTicks:= random(20) + 15; |
|
221 |
end; |
|
222 |
vgtSplash: |
|
223 |
begin |
|
224 |
dx:= 0; |
|
225 |
dy:= 0; |
|
226 |
FrameTicks:= 740; |
|
227 |
Frame:= 19; |
|
228 |
Scale:= 0.75; |
|
229 |
Timer:= 1; |
|
230 |
end; |
|
231 |
vgtDroplet: |
|
232 |
begin |
|
11857
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
233 |
// old dx & dy calcs |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
234 |
// dx:= 0.001 * (random(180) - 90); |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
235 |
// dy:= -0.001 * (random(160) + 40); |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
236 |
// => min speed ~ 0.098, max speed ~ 0.218, speed range ~ 0.120 |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
237 |
// => min angle(4096) ~ 129, max angle ~ 1919, angle range ~ 1790 |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
238 |
dx:= 0.001 * (98 + random(121)); // speed |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
239 |
Frame:= 129 + random(1791); // angle |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
240 |
dy:= -dx * hwFloat2Float(AngleSin(Frame)); |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
241 |
// divide by 2 to create an eliptic shape |
cb137eb71556
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents:
11046
diff
changeset
|
242 |
dx:= dx * hwFloat2Float(AngleCos(Frame)) / 2; |
9287 | 243 |
FrameTicks:= 250 + random(1751); |
244 |
Frame:= random(3) |
|
245 |
end; |
|
246 |
vgtBeeTrace: |
|
247 |
begin |
|
248 |
FrameTicks:= 1000; |
|
249 |
Frame:= random(16); |
|
250 |
end; |
|
251 |
vgtSmokeRing: |
|
252 |
begin |
|
253 |
dx:= 0; |
|
254 |
dy:= 0; |
|
255 |
FrameTicks:= 600; |
|
256 |
Timer:= 0; |
|
257 |
Frame:= 0; |
|
258 |
scale:= 0.6; |
|
259 |
alpha:= 1; |
|
260 |
angle:= random(360); |
|
261 |
end; |
|
262 |
vgtFeather: |
|
263 |
begin |
|
264 |
t:= random(1024); |
|
265 |
sp:= 0.001 * (random(85) + 95); |
|
266 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
267 |
dy:= hwFloat2Float(AngleCos(t)) * sp; |
|
268 |
if random(2) = 0 then |
|
269 |
dx := -dx; |
|
270 |
if random(2) = 0 then |
|
271 |
dy := -dy; |
|
272 |
FrameTicks:= 650 + random(250); |
|
273 |
Frame:= 1 |
|
274 |
end; |
|
275 |
vgtHealthTag: |
|
276 |
begin |
|
277 |
Frame:= 0; |
|
278 |
Timer:= 1500; |
|
279 |
dY:= -0.08; |
|
280 |
dX:= 0; |
|
281 |
//gear^.Z:= 2002; |
|
282 |
end; |
|
283 |
vgtSmokeTrace, |
|
284 |
vgtEvilTrace: |
|
285 |
begin |
|
286 |
gear^.X:= gear^.X - 16; |
|
287 |
gear^.Y:= gear^.Y - 16; |
|
288 |
gear^.State:= 8; |
|
289 |
//gear^.Z:= cSmokeZ |
|
290 |
end; |
|
291 |
vgtBigExplosion: |
|
292 |
begin |
|
293 |
gear^.Angle:= random(360); |
|
294 |
end; |
|
295 |
vgtChunk: |
|
296 |
begin |
|
297 |
gear^.Frame:= random(4); |
|
298 |
t:= random(1024); |
|
299 |
sp:= 0.001 * (random(85) + 47); |
|
300 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
301 |
dy:= hwFloat2Float(AngleCos(t)) * sp * -2; |
|
302 |
if random(2) = 0 then |
|
303 |
dx := -dx; |
|
304 |
end; |
|
10015 | 305 |
vgtNote: |
9287 | 306 |
begin |
307 |
dx:= 0.005 * (random(15) + 10); |
|
308 |
dy:= -0.001 * (random(40) + 20); |
|
309 |
if random(2) = 0 then |
|
310 |
dx := -dx; |
|
311 |
Frame:= random(4); |
|
312 |
FrameTicks:= random(2000) + 1500; |
|
313 |
end; |
|
314 |
vgtBulletHit: |
|
315 |
begin |
|
316 |
dx:= 0; |
|
317 |
dy:= 0; |
|
318 |
FrameTicks:= 350; |
|
319 |
Frame:= 7; |
|
320 |
Angle:= 0; |
|
321 |
end; |
|
10015 | 322 |
vgtSmoothWindBar: |
9287 | 323 |
begin |
324 |
Angle:= hwFloat2Float(cMaxWindSpeed)*2 / 1440; // seems rate below is supposed to change wind bar at 1px per 10ms. Max time, 1440ms. This tries to match the rate of change |
|
325 |
Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed); |
|
326 |
end; |
|
327 |
vgtStraightShot: |
|
328 |
begin |
|
329 |
Angle:= 0; |
|
330 |
Scale:= 1.0; |
|
331 |
dx:= 0.001 * random(45); |
|
332 |
dy:= 0.001 * (random(20) + 25); |
|
333 |
State:= ord(sprHealth); |
|
334 |
if random(2) = 0 then |
|
335 |
dx := -dx; |
|
336 |
Frame:= 0; |
|
337 |
FrameTicks:= random(750) + 1250; |
|
338 |
State:= ord(sprSnowDust); |
|
339 |
end; |
|
10251
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10193
diff
changeset
|
340 |
vgtNoPlaceWarn: |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10193
diff
changeset
|
341 |
begin |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10193
diff
changeset
|
342 |
FrameTicks:= 2000; |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10193
diff
changeset
|
343 |
Tint:= $FF0000FF; |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10193
diff
changeset
|
344 |
Scale:= 1.0; |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10193
diff
changeset
|
345 |
end; |
9287 | 346 |
end; |
347 |
||
348 |
if State <> 0 then |
|
349 |
gear^.State:= State; |
|
350 |
||
351 |
case Gear^.Kind of |
|
12110
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
352 |
vgtFlake: |
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
353 |
if random(3) = 0 then |
9287 | 354 |
begin |
355 |
gear^.Scale:= 0.5; |
|
356 |
gear^.Layer:= 0 // 33% - far back |
|
357 |
end |
|
358 |
else if random(3) = 0 then |
|
359 |
begin |
|
360 |
gear^.Scale:= 0.8; |
|
361 |
gear^.Layer:= 4 // 22% - mid-distance |
|
362 |
end |
|
363 |
else if random(3) <> 0 then |
|
364 |
gear^.Layer:= 5 // 30% - just behind land |
|
12110
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
365 |
else if (not cFlattenFlakes) and (random(2) = 0) then |
9287 | 366 |
gear^.Layer:= 6 // 7% - just in front of land |
12110
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
367 |
else if not cFlattenFlakes then |
9287 | 368 |
begin |
369 |
gear^.Scale:= 1.5; |
|
12110
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
370 |
gear^.Layer:= 2 // 7% - close up |
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
371 |
end |
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
372 |
else begin |
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
373 |
gear^.Layer:= 0; |
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
374 |
gear^.Scale:= 0.5 |
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
375 |
end; |
9287 | 376 |
|
377 |
vgtCloud: if cFlattenClouds then gear^.Layer:= 5 |
|
378 |
else if random(3) = 0 then |
|
379 |
begin |
|
380 |
gear^.Scale:= 0.25; |
|
381 |
gear^.Layer:= 0 |
|
382 |
end |
|
383 |
else if random(2) = 0 then |
|
384 |
gear^.Layer:= 5 |
|
385 |
else |
|
386 |
begin |
|
387 |
gear^.Scale:= 0.4; |
|
388 |
gear^.Layer:= 4 |
|
389 |
end; |
|
10251
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10193
diff
changeset
|
390 |
vgtNoPlaceWarn: gear^.Layer:= 6; |
9287 | 391 |
|
392 |
// 0: this layer is very distant in the background when in stereo |
|
393 |
vgtTeamHealthSorter, |
|
394 |
vgtSmoothWindBar: gear^.Layer:= 0; |
|
395 |
||
396 |
||
397 |
// 1: this layer is on the land level (which is close but behind the screen plane) when stereo |
|
398 |
vgtSmokeTrace, |
|
399 |
vgtEvilTrace, |
|
400 |
vgtLineTrail, |
|
401 |
vgtSmoke, |
|
402 |
vgtSmokeWhite, |
|
403 |
vgtDust, |
|
404 |
vgtFire, |
|
405 |
vgtSplash, |
|
406 |
vgtDroplet, |
|
407 |
vgtBubble: gear^.Layer:= 1; |
|
408 |
||
409 |
// 3: this layer is on the screen plane (depth = 0) when stereo |
|
410 |
vgtSpeechBubble, |
|
411 |
vgtSmallDamageTag, |
|
412 |
vgtHealthTag, |
|
413 |
vgtStraightShot, |
|
10876 | 414 |
vgtFeather, |
9287 | 415 |
vgtChunk: gear^.Layer:= 3; |
416 |
||
417 |
// 2: this layer is outside the screen when stereo |
|
418 |
vgtExplosion, |
|
419 |
vgtBigExplosion, |
|
420 |
vgtExplPart, |
|
421 |
vgtExplPart2, |
|
422 |
vgtSteam, |
|
423 |
vgtAmmo, |
|
424 |
vgtShell, |
|
425 |
vgtEgg, |
|
426 |
vgtBeeTrace, |
|
427 |
vgtSmokeRing, |
|
428 |
vgtNote, |
|
429 |
vgtBulletHit, |
|
430 |
vgtCircle: gear^.Layer:= 2 |
|
431 |
end; |
|
432 |
||
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
433 |
if Layer <> -1 then gear^.Layer:= Layer; |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9287
diff
changeset
|
434 |
|
9287 | 435 |
if VisualGearLayers[gear^.Layer] <> nil then |
436 |
begin |
|
437 |
VisualGearLayers[gear^.Layer]^.PrevGear:= gear; |
|
438 |
gear^.NextGear:= VisualGearLayers[gear^.Layer] |
|
439 |
end; |
|
440 |
VisualGearLayers[gear^.Layer]:= gear; |
|
441 |
||
442 |
AddVisualGear:= gear; |
|
11880
2eac7a96b342
Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents:
11857
diff
changeset
|
443 |
ScriptCall('onVisualGearAdd', gear^.uid); |
9287 | 444 |
end; |
445 |
||
446 |
procedure DeleteVisualGear(Gear: PVisualGear); |
|
447 |
begin |
|
11880
2eac7a96b342
Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents:
11857
diff
changeset
|
448 |
ScriptCall('onVisualGearDelete', Gear^.uid); |
10634
35d059bd0932
Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents:
10625
diff
changeset
|
449 |
FreeAndNilTexture(Gear^.Tex); |
9287 | 450 |
|
451 |
if Gear^.NextGear <> nil then |
|
452 |
Gear^.NextGear^.PrevGear:= Gear^.PrevGear; |
|
453 |
if Gear^.PrevGear <> nil then |
|
454 |
Gear^.PrevGear^.NextGear:= Gear^.NextGear |
|
455 |
else |
|
456 |
VisualGearLayers[Gear^.Layer]:= Gear^.NextGear; |
|
457 |
||
458 |
if lastVisualGearByUID = Gear then |
|
459 |
lastVisualGearByUID:= nil; |
|
460 |
||
461 |
Dispose(Gear); |
|
462 |
end; |
|
463 |
||
464 |
function VisualGearByUID(uid : Longword) : PVisualGear; |
|
465 |
var vg: PVisualGear; |
|
466 |
i: LongWord; |
|
467 |
begin |
|
468 |
VisualGearByUID:= nil; |
|
469 |
if uid = 0 then |
|
470 |
exit; |
|
471 |
if (lastVisualGearByUID <> nil) and (lastVisualGearByUID^.uid = uid) then |
|
472 |
begin |
|
473 |
VisualGearByUID:= lastVisualGearByUID; |
|
474 |
exit |
|
475 |
end; |
|
476 |
// search in an order that is more likely to return layers they actually use. Could perhaps track statistically AddVisualGear in uScript, since that is most likely the ones they want |
|
477 |
for i:= 2 to 5 do |
|
478 |
begin |
|
479 |
vg:= VisualGearLayers[i mod 4]; |
|
480 |
while vg <> nil do |
|
481 |
begin |
|
482 |
if vg^.uid = uid then |
|
483 |
begin |
|
484 |
lastVisualGearByUID:= vg; |
|
485 |
VisualGearByUID:= vg; |
|
486 |
exit |
|
487 |
end; |
|
488 |
vg:= vg^.NextGear |
|
489 |
end |
|
490 |
end |
|
491 |
end; |
|
492 |
||
493 |
||
494 |
end. |