author | alfadur |
Tue, 05 Feb 2019 22:40:35 +0300 | |
changeset 14705 | bc267f6b29d7 |
parent 14678 | b390479f24c1 |
child 15118 | 260e96addf92 |
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; |
|
14605
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
36 |
VisualGearLayersStart: array[0..6] of PVisualGear; |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
37 |
VisualGearLayersEnd: array[0..6] of PVisualGear; |
9287 | 38 |
|
39 |
implementation |
|
11880
2eac7a96b342
Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents:
11857
diff
changeset
|
40 |
uses uCollisions, uFloat, uVariables, uConsts, uTextures, uVisualGearsHandlers, uScript; |
9287 | 41 |
|
42 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline; |
|
43 |
begin |
|
10352 | 44 |
// adjust some visual gear types if underwater |
10354 | 45 |
if CheckCoordInWater(X, Y) and ((Kind = vgtBeeTrace) or (Kind = vgtSmokeTrace) or (Kind = vgtEvilTrace)) then |
10352 | 46 |
Kind:= vgtBubble; |
47 |
||
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
|
48 |
AddVisualGear:= AddVisualGear(X, Y, Kind, 0, false, -1); |
9287 | 49 |
end; |
50 |
||
51 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline; |
|
52 |
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
|
53 |
AddVisualGear:= AddVisualGear(X, Y, Kind, State, false, -1); |
9287 | 54 |
end; |
55 |
||
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
|
56 |
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
|
57 |
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
|
58 |
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
|
59 |
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
|
60 |
|
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
|
61 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear; |
9287 | 62 |
var gear: PVisualGear; |
63 |
t: Longword; |
|
64 |
sp: real; |
|
65 |
begin |
|
66 |
AddVisualGear:= nil; |
|
13040
a87d3119c962
VideoRec: Fix many effects not being recorded
Wuzzy <Wuzzy2@mail.ru>
parents:
12110
diff
changeset
|
67 |
if (GameType <> gmtRecord) and |
a87d3119c962
VideoRec: Fix many effects not being recorded
Wuzzy <Wuzzy2@mail.ru>
parents:
12110
diff
changeset
|
68 |
(((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) or fastScrolling) and // we are scrolling now |
13329
e8801220c13f
minor simplification of conditions for not spawning a visual gear - also allows lua to spawn clouds critically or non-critically. We probably shouldn't even exempt clouds from this, and just spawn them once synced, but, eh, probably isn't a significant hit since sheepluva made the motion more efficient.
nemo
parents:
13040
diff
changeset
|
69 |
(not Critical)) then |
9287 | 70 |
exit; |
71 |
||
72 |
if ((cReducedQuality and rqAntiBoom) <> 0) and |
|
73 |
(not Critical) and |
|
74 |
(not (Kind in |
|
75 |
[vgtTeamHealthSorter, |
|
76 |
vgtSmallDamageTag, |
|
77 |
vgtSpeechBubble, |
|
78 |
vgtHealthTag, |
|
79 |
vgtExplosion, |
|
80 |
vgtSmokeTrace, |
|
81 |
vgtEvilTrace, |
|
82 |
vgtNote, |
|
10876 | 83 |
vgtFeather, |
9287 | 84 |
vgtSmoothWindBar])) then |
10015 | 85 |
|
9287 | 86 |
exit; |
87 |
||
88 |
inc(VGCounter); |
|
89 |
New(gear); |
|
90 |
FillChar(gear^, sizeof(TVisualGear), 0); |
|
91 |
gear^.X:= real(X); |
|
92 |
gear^.Y:= real(Y); |
|
93 |
gear^.Kind := Kind; |
|
9960 | 94 |
gear^.doStep:= doStepVGHandlers[Kind]; |
9287 | 95 |
gear^.Tint:= $FFFFFFFF; |
96 |
gear^.uid:= VGCounter; |
|
97 |
||
98 |
with gear^ do |
|
99 |
case Kind of |
|
100 |
vgtFlake: |
|
101 |
begin |
|
102 |
Timer:= 0; |
|
103 |
tdX:= 0; |
|
104 |
tdY:= 0; |
|
105 |
Scale:= 1.0; |
|
106 |
if SuddenDeathDmg then |
|
107 |
begin |
|
10625
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10354
diff
changeset
|
108 |
if vobSDFrameTicks > 0 then |
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10354
diff
changeset
|
109 |
FrameTicks:= random(vobSDFrameTicks); |
9287 | 110 |
Frame:= random(vobSDFramesCount); |
111 |
end |
|
112 |
else |
|
113 |
begin |
|
10625
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10354
diff
changeset
|
114 |
if vobFrameTicks > 0 then |
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10354
diff
changeset
|
115 |
FrameTicks:= random(vobFrameTicks); |
9287 | 116 |
Frame:= random(vobFramesCount); |
117 |
end; |
|
118 |
Angle:= random(360); |
|
119 |
dx:= 0.0000038654705 * random(10000); |
|
120 |
dy:= 0.000003506096 * random(7000); |
|
121 |
if random(2) = 0 then |
|
122 |
dx := -dx; |
|
123 |
if SuddenDeathDmg then |
|
124 |
dAngle:= (random(2) * 2 - 1) * (vobSDVelocity + random(vobSDVelocity)) / 1000 |
|
125 |
else |
|
126 |
dAngle:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) / 1000 |
|
127 |
end; |
|
128 |
vgtCloud: |
|
129 |
begin |
|
130 |
Frame:= random(4); |
|
131 |
dx:= 0.5 + 0.1 * random(5); // how much the cloud will be affected by wind |
|
132 |
timer:= random(4096); |
|
133 |
Scale:= 1.0 |
|
134 |
end; |
|
135 |
vgtExplPart, |
|
136 |
vgtExplPart2: |
|
137 |
begin |
|
138 |
t:= random(1024); |
|
139 |
sp:= 0.001 * (random(95) + 70); |
|
140 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
141 |
dy:= hwFloat2Float(AngleCos(t)) * sp; |
|
142 |
if random(2) = 0 then |
|
143 |
dx := -dx; |
|
144 |
if random(2) = 0 then |
|
145 |
dy := -dy; |
|
146 |
Frame:= 7 - random(3); |
|
147 |
FrameTicks:= cExplFrameTicks |
|
148 |
end; |
|
149 |
vgtFire: |
|
150 |
begin |
|
151 |
t:= random(1024); |
|
152 |
sp:= 0.001 * (random(85) + 95); |
|
153 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
154 |
dy:= hwFloat2Float(AngleCos(t)) * sp; |
|
155 |
if random(2) = 0 then |
|
156 |
dx := -dx; |
|
157 |
if random(2) = 0 then |
|
158 |
dy := -dy; |
|
159 |
FrameTicks:= 650 + random(250); |
|
160 |
Frame:= random(8) |
|
161 |
end; |
|
162 |
vgtEgg: |
|
163 |
begin |
|
164 |
t:= random(1024); |
|
165 |
sp:= 0.001 * (random(85) + 95); |
|
166 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
167 |
dy:= hwFloat2Float(AngleCos(t)) * sp; |
|
168 |
if random(2) = 0 then |
|
169 |
dx := -dx; |
|
170 |
if random(2) = 0 then |
|
171 |
dy := -dy; |
|
172 |
FrameTicks:= 650 + random(250); |
|
173 |
Frame:= 1 |
|
174 |
end; |
|
175 |
vgtShell: FrameTicks:= 500; |
|
176 |
vgtSmallDamageTag: |
|
177 |
begin |
|
178 |
gear^.FrameTicks:= 1100 |
|
179 |
end; |
|
180 |
vgtBubble: |
|
181 |
begin |
|
182 |
dx:= 0.0000038654705 * random(10000); |
|
183 |
dy:= 0; |
|
184 |
if random(2) = 0 then |
|
185 |
dx := -dx; |
|
186 |
FrameTicks:= 250 + random(1751); |
|
187 |
Frame:= random(5) |
|
188 |
end; |
|
189 |
vgtSteam: |
|
190 |
begin |
|
191 |
dx:= 0.0000038654705 * random(10000); |
|
192 |
dy:= 0.001 * (random(85) + 95); |
|
193 |
if random(2) = 0 then |
|
194 |
dx := -dx; |
|
195 |
Frame:= 7 - random(3); |
|
196 |
FrameTicks:= cExplFrameTicks * 2; |
|
197 |
end; |
|
198 |
vgtAmmo: |
|
199 |
begin |
|
200 |
alpha:= 1.0; |
|
201 |
scale:= 1.0 |
|
202 |
end; |
|
203 |
vgtSmokeWhite, |
|
204 |
vgtSmoke: |
|
205 |
begin |
|
206 |
Scale:= 1.0; |
|
207 |
dx:= 0.0002 * (random(45) + 10); |
|
208 |
dy:= 0.0002 * (random(45) + 10); |
|
209 |
if random(2) = 0 then |
|
210 |
dx := -dx; |
|
211 |
Frame:= 7 - random(2); |
|
212 |
FrameTicks:= cExplFrameTicks * 2; |
|
213 |
end; |
|
214 |
vgtDust: |
|
215 |
begin |
|
216 |
dx:= 0.005 * (random(15) + 10); |
|
217 |
dy:= 0.001 * (random(40) + 20); |
|
218 |
if random(2) = 0 then dx := -dx; |
|
219 |
if random(2) = 0 then Tag:= 1 |
|
220 |
else Tag:= -1; |
|
221 |
Frame:= 7 - random(2); |
|
222 |
FrameTicks:= random(20) + 15; |
|
223 |
end; |
|
224 |
vgtSplash: |
|
225 |
begin |
|
226 |
dx:= 0; |
|
227 |
dy:= 0; |
|
228 |
FrameTicks:= 740; |
|
229 |
Frame:= 19; |
|
230 |
Scale:= 0.75; |
|
231 |
Timer:= 1; |
|
232 |
end; |
|
233 |
vgtDroplet: |
|
234 |
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
|
235 |
// => 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
|
236 |
// => 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
|
237 |
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
|
238 |
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
|
239 |
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
|
240 |
// 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
|
241 |
dx:= dx * hwFloat2Float(AngleCos(Frame)) / 2; |
9287 | 242 |
FrameTicks:= 250 + random(1751); |
243 |
Frame:= random(3) |
|
244 |
end; |
|
245 |
vgtBeeTrace: |
|
246 |
begin |
|
247 |
FrameTicks:= 1000; |
|
248 |
Frame:= random(16); |
|
249 |
end; |
|
250 |
vgtSmokeRing: |
|
251 |
begin |
|
252 |
dx:= 0; |
|
253 |
dy:= 0; |
|
254 |
FrameTicks:= 600; |
|
255 |
Timer:= 0; |
|
256 |
Frame:= 0; |
|
257 |
scale:= 0.6; |
|
258 |
alpha:= 1; |
|
259 |
angle:= random(360); |
|
260 |
end; |
|
261 |
vgtFeather: |
|
262 |
begin |
|
263 |
t:= random(1024); |
|
264 |
sp:= 0.001 * (random(85) + 95); |
|
265 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
266 |
dy:= hwFloat2Float(AngleCos(t)) * sp; |
|
267 |
if random(2) = 0 then |
|
268 |
dx := -dx; |
|
269 |
if random(2) = 0 then |
|
270 |
dy := -dy; |
|
271 |
FrameTicks:= 650 + random(250); |
|
272 |
Frame:= 1 |
|
273 |
end; |
|
274 |
vgtHealthTag: |
|
275 |
begin |
|
276 |
Frame:= 0; |
|
14678
b390479f24c1
vgtHealthTag now supports setting FrameTicks <> 0 to disable automatic water handling
Wuzzy <Wuzzy2@mail.ru>
parents:
14605
diff
changeset
|
277 |
FrameTicks:= 0; |
9287 | 278 |
Timer:= 1500; |
279 |
dY:= -0.08; |
|
280 |
dX:= 0; |
|
281 |
end; |
|
282 |
vgtSmokeTrace, |
|
283 |
vgtEvilTrace: |
|
284 |
begin |
|
285 |
gear^.X:= gear^.X - 16; |
|
286 |
gear^.Y:= gear^.Y - 16; |
|
287 |
gear^.State:= 8; |
|
288 |
end; |
|
289 |
vgtBigExplosion: |
|
290 |
begin |
|
291 |
gear^.Angle:= random(360); |
|
292 |
end; |
|
293 |
vgtChunk: |
|
294 |
begin |
|
295 |
gear^.Frame:= random(4); |
|
296 |
t:= random(1024); |
|
297 |
sp:= 0.001 * (random(85) + 47); |
|
298 |
dx:= hwFloat2Float(AngleSin(t)) * sp; |
|
299 |
dy:= hwFloat2Float(AngleCos(t)) * sp * -2; |
|
300 |
if random(2) = 0 then |
|
301 |
dx := -dx; |
|
302 |
end; |
|
10015 | 303 |
vgtNote: |
9287 | 304 |
begin |
305 |
dx:= 0.005 * (random(15) + 10); |
|
306 |
dy:= -0.001 * (random(40) + 20); |
|
307 |
if random(2) = 0 then |
|
308 |
dx := -dx; |
|
309 |
Frame:= random(4); |
|
310 |
FrameTicks:= random(2000) + 1500; |
|
311 |
end; |
|
312 |
vgtBulletHit: |
|
313 |
begin |
|
314 |
dx:= 0; |
|
315 |
dy:= 0; |
|
316 |
FrameTicks:= 350; |
|
317 |
Frame:= 7; |
|
318 |
Angle:= 0; |
|
319 |
end; |
|
10015 | 320 |
vgtSmoothWindBar: |
9287 | 321 |
begin |
322 |
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 |
|
323 |
Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed); |
|
324 |
end; |
|
325 |
vgtStraightShot: |
|
326 |
begin |
|
327 |
Angle:= 0; |
|
328 |
Scale:= 1.0; |
|
329 |
dx:= 0.001 * random(45); |
|
330 |
dy:= 0.001 * (random(20) + 25); |
|
331 |
State:= ord(sprHealth); |
|
332 |
if random(2) = 0 then |
|
333 |
dx := -dx; |
|
334 |
Frame:= 0; |
|
335 |
FrameTicks:= random(750) + 1250; |
|
336 |
State:= ord(sprSnowDust); |
|
337 |
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
|
338 |
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
|
339 |
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
|
340 |
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
|
341 |
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
|
342 |
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
|
343 |
end; |
9287 | 344 |
end; |
345 |
||
346 |
if State <> 0 then |
|
347 |
gear^.State:= State; |
|
348 |
||
349 |
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
|
350 |
vgtFlake: |
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
351 |
if random(3) = 0 then |
9287 | 352 |
begin |
353 |
gear^.Scale:= 0.5; |
|
354 |
gear^.Layer:= 0 // 33% - far back |
|
355 |
end |
|
356 |
else if random(3) = 0 then |
|
357 |
begin |
|
358 |
gear^.Scale:= 0.8; |
|
359 |
gear^.Layer:= 4 // 22% - mid-distance |
|
360 |
end |
|
361 |
else if random(3) <> 0 then |
|
362 |
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
|
363 |
else if (not cFlattenFlakes) and (random(2) = 0) then |
9287 | 364 |
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
|
365 |
else if not cFlattenFlakes then |
9287 | 366 |
begin |
367 |
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
|
368 |
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
|
369 |
end |
f214d6315b71
requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents:
11880
diff
changeset
|
370 |
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
|
371 |
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
|
372 |
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
|
373 |
end; |
9287 | 374 |
|
375 |
vgtCloud: if cFlattenClouds then gear^.Layer:= 5 |
|
376 |
else if random(3) = 0 then |
|
377 |
begin |
|
378 |
gear^.Scale:= 0.25; |
|
379 |
gear^.Layer:= 0 |
|
380 |
end |
|
381 |
else if random(2) = 0 then |
|
382 |
gear^.Layer:= 5 |
|
383 |
else |
|
384 |
begin |
|
385 |
gear^.Scale:= 0.4; |
|
386 |
gear^.Layer:= 4 |
|
387 |
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
|
388 |
vgtNoPlaceWarn: gear^.Layer:= 6; |
9287 | 389 |
|
390 |
// 0: this layer is very distant in the background when in stereo |
|
391 |
vgtTeamHealthSorter, |
|
392 |
vgtSmoothWindBar: gear^.Layer:= 0; |
|
393 |
||
394 |
||
395 |
// 1: this layer is on the land level (which is close but behind the screen plane) when stereo |
|
396 |
vgtSmokeTrace, |
|
397 |
vgtEvilTrace, |
|
398 |
vgtLineTrail, |
|
399 |
vgtSmoke, |
|
400 |
vgtSmokeWhite, |
|
401 |
vgtDust, |
|
402 |
vgtFire, |
|
403 |
vgtSplash, |
|
404 |
vgtDroplet, |
|
405 |
vgtBubble: gear^.Layer:= 1; |
|
406 |
||
407 |
// 3: this layer is on the screen plane (depth = 0) when stereo |
|
408 |
vgtSpeechBubble, |
|
409 |
vgtSmallDamageTag, |
|
410 |
vgtHealthTag, |
|
411 |
vgtStraightShot, |
|
10876 | 412 |
vgtFeather, |
9287 | 413 |
vgtChunk: gear^.Layer:= 3; |
414 |
||
415 |
// 2: this layer is outside the screen when stereo |
|
416 |
vgtExplosion, |
|
417 |
vgtBigExplosion, |
|
418 |
vgtExplPart, |
|
419 |
vgtExplPart2, |
|
420 |
vgtSteam, |
|
421 |
vgtAmmo, |
|
422 |
vgtShell, |
|
423 |
vgtEgg, |
|
424 |
vgtBeeTrace, |
|
425 |
vgtSmokeRing, |
|
426 |
vgtNote, |
|
427 |
vgtBulletHit, |
|
428 |
vgtCircle: gear^.Layer:= 2 |
|
429 |
end; |
|
430 |
||
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
|
431 |
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
|
432 |
|
14605
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
433 |
if VisualGearLayersStart[gear^.Layer] = nil then |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
434 |
VisualGearLayersStart[gear^.Layer]:= gear; |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
435 |
|
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
436 |
if VisualGearLayersEnd[gear^.Layer] <> nil then |
9287 | 437 |
begin |
14605
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
438 |
VisualGearLayersEnd[gear^.Layer]^.NextGear:= gear; |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
439 |
gear^.PrevGear:= VisualGearLayersEnd[gear^.Layer] |
9287 | 440 |
end; |
14605
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
441 |
VisualGearLayersEnd[gear^.Layer]:= gear; |
9287 | 442 |
|
443 |
AddVisualGear:= gear; |
|
11880
2eac7a96b342
Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents:
11857
diff
changeset
|
444 |
ScriptCall('onVisualGearAdd', gear^.uid); |
9287 | 445 |
end; |
446 |
||
447 |
procedure DeleteVisualGear(Gear: PVisualGear); |
|
448 |
begin |
|
11880
2eac7a96b342
Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents:
11857
diff
changeset
|
449 |
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
|
450 |
FreeAndNilTexture(Gear^.Tex); |
9287 | 451 |
|
14605
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
452 |
if (Gear^.NextGear = nil) and (Gear^.PrevGear = nil) then |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
453 |
begin |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
454 |
VisualGearLayersStart[Gear^.Layer]:= nil; |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
455 |
VisualGearLayersEnd[Gear^.Layer]:= nil; |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
456 |
end; |
9287 | 457 |
if Gear^.PrevGear <> nil then |
458 |
Gear^.PrevGear^.NextGear:= Gear^.NextGear |
|
14605
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
459 |
else if Gear^.NextGear <> nil then |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
460 |
VisualGearLayersStart[Gear^.Layer]:= Gear^.NextGear; |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
461 |
if Gear^.NextGear <> nil then |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
462 |
Gear^.NextGear^.PrevGear:= Gear^.PrevGear |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
463 |
else if Gear^.PrevGear <> nil then |
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
464 |
VisualGearLayersEnd[Gear^.Layer]:= Gear^.PrevGear; |
9287 | 465 |
|
466 |
if lastVisualGearByUID = Gear then |
|
467 |
lastVisualGearByUID:= nil; |
|
468 |
||
469 |
Dispose(Gear); |
|
470 |
end; |
|
471 |
||
472 |
function VisualGearByUID(uid : Longword) : PVisualGear; |
|
473 |
var vg: PVisualGear; |
|
474 |
i: LongWord; |
|
475 |
begin |
|
476 |
VisualGearByUID:= nil; |
|
477 |
if uid = 0 then |
|
478 |
exit; |
|
479 |
if (lastVisualGearByUID <> nil) and (lastVisualGearByUID^.uid = uid) then |
|
480 |
begin |
|
481 |
VisualGearByUID:= lastVisualGearByUID; |
|
482 |
exit |
|
483 |
end; |
|
484 |
// 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 |
|
485 |
for i:= 2 to 5 do |
|
486 |
begin |
|
14605
ab79cd4a7382
Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents:
14593
diff
changeset
|
487 |
vg:= VisualGearLayersStart[i mod 4]; |
9287 | 488 |
while vg <> nil do |
489 |
begin |
|
490 |
if vg^.uid = uid then |
|
491 |
begin |
|
492 |
lastVisualGearByUID:= vg; |
|
493 |
VisualGearByUID:= vg; |
|
494 |
exit |
|
495 |
end; |
|
496 |
vg:= vg^.NextGear |
|
497 |
end |
|
498 |
end |
|
499 |
end; |
|
500 |
||
501 |
||
502 |
end. |