author | unc0rr |
Mon, 23 Mar 2009 21:09:34 +0000 | |
changeset 1916 | 9c3d0e3df6bb |
parent 1906 | 644f93d8f148 |
child 2005 | aa79f631711b |
permissions | -rw-r--r-- |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
3 |
* Copyright (c) 2008 Andrey Korotaev <unC0Rr@gmail.com> |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
4 |
* |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
8 |
* |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
13 |
* |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
17 |
*) |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
18 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
19 |
unit uVisualGears; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
20 |
interface |
1906 | 21 |
uses SDLh, uConsts, |
22 |
{$IFDEF IPHONE} |
|
23 |
gles11, |
|
24 |
{$ELSE} |
|
25 |
GL, |
|
26 |
{$ENDIF} |
|
27 |
uFloat; |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
28 |
{$INCLUDE options.inc} |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
29 |
const AllInactive: boolean = false; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
30 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
31 |
type PVisualGear = ^TVisualGear; |
1505 | 32 |
TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword); |
33 |
TVisualGear = record |
|
34 |
NextGear, PrevGear: PVisualGear; |
|
35 |
Frame, |
|
36 |
FrameTicks: Longword; |
|
37 |
X : hwFloat; |
|
38 |
Y : hwFloat; |
|
39 |
dX: hwFloat; |
|
40 |
dY: hwFloat; |
|
41 |
mdY: QWord; |
|
42 |
Angle, dAngle: real; |
|
43 |
Kind: TVisualGearType; |
|
44 |
doStep: TVGearStepProcedure; |
|
45 |
Tex: PTexture; |
|
46 |
end; |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
47 |
|
805 | 48 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
49 |
procedure ProcessVisualGears(Steps: Longword); |
1045 | 50 |
procedure DrawVisualGears(Layer: LongWord); |
1041 | 51 |
procedure DeleteVisualGear(Gear: PVisualGear); |
803 | 52 |
procedure AddClouds; |
1505 | 53 |
procedure AddDamageTag(X, Y, Damage, Color: LongWord); |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
54 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
55 |
var VisualGearsList: PVisualGear = nil; |
1505 | 56 |
vobFrameTicks, vobFramesCount: Longword; |
57 |
vobVelocity, vobFallSpeed: LongInt; |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
58 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
59 |
implementation |
805 | 60 |
uses uWorld, uMisc, uStore; |
1047 | 61 |
const cExplFrameTicks = 110; |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
62 |
|
1505 | 63 |
procedure AddDamageTag(X, Y, Damage, Color: LongWord); |
64 |
var s: shortstring; |
|
1729 | 65 |
Gear: PVisualGear; |
1505 | 66 |
begin |
67 |
if cAltDamage then |
|
1729 | 68 |
begin |
69 |
Gear:= AddVisualGear(X, Y, vgtSmallDamageTag); |
|
70 |
if Gear <> nil then |
|
71 |
with Gear^ do |
|
72 |
begin |
|
73 |
str(Damage, s); |
|
74 |
Tex:= RenderStringTex(s, Color, fntSmall); |
|
75 |
end |
|
76 |
end |
|
1505 | 77 |
end; |
78 |
||
79 |
||
803 | 80 |
// ================================================================== |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
81 |
procedure doStepFlake(Gear: PVisualGear; Steps: Longword); |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
82 |
begin |
805 | 83 |
with Gear^ do |
1505 | 84 |
begin |
85 |
inc(FrameTicks, Steps); |
|
86 |
if FrameTicks > vobFrameTicks then |
|
87 |
begin |
|
88 |
dec(FrameTicks, vobFrameTicks); |
|
89 |
inc(Frame); |
|
90 |
if Frame = vobFramesCount then Frame:= 0 |
|
91 |
end |
|
92 |
end; |
|
805 | 93 |
|
94 |
Gear^.X:= Gear^.X + (cWindSpeed * 200 + Gear^.dX) * Steps; |
|
808 | 95 |
Gear^.Y:= Gear^.Y + (Gear^.dY + cGravity * vobFallSpeed) * Steps; |
96 |
Gear^.Angle:= Gear^.Angle + Gear^.dAngle * Steps; |
|
805 | 97 |
|
1760 | 98 |
if hwRound(Gear^.X) < -cScreenWidth - 64 then Gear^.X:= int2hwFloat(cScreenWidth + LAND_WIDTH) else |
99 |
if hwRound(Gear^.X) > cScreenWidth + LAND_WIDTH then Gear^.X:= int2hwFloat(-cScreenWidth - 64); |
|
1869 | 100 |
// if hwRound(Gear^.Y) < (LAND_HEIGHT - 1024 - 75) then Gear^.Y:= Gear^.Y + int2hwFloat(25); // For if flag is set for flakes rising upwards? |
101 |
if hwRound(Gear^.Y) > (LAND_HEIGHT + 75) then Gear^.Y:= Gear^.Y - int2hwFloat(1024 + 150) // TODO - configure in theme (jellies for example could use limited range) |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
102 |
end; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
103 |
|
803 | 104 |
procedure doStepCloud(Gear: PVisualGear; Steps: Longword); |
1079 | 105 |
var i: Longword; |
803 | 106 |
begin |
107 |
Gear^.X:= Gear^.X + (cWindSpeed * 200 + Gear^.dX) * Steps; |
|
805 | 108 |
|
1079 | 109 |
for i:= 0 to Steps - 1 do |
110 |
begin |
|
1776 | 111 |
if hwRound(Gear^.Y) > LAND_HEIGHT-1184 then // TODO - configure in theme |
1079 | 112 |
Gear^.dY:= Gear^.dY - _1div50000 |
113 |
else |
|
114 |
Gear^.dY:= Gear^.dY + _1div50000; |
|
115 |
||
116 |
Gear^.Y:= Gear^.Y + Gear^.dY |
|
117 |
end; |
|
805 | 118 |
|
1801 | 119 |
if hwRound(Gear^.X) < -cScreenWidth - 256 then Gear^.X:= int2hwFloat(cScreenWidth + LAND_WIDTH) else |
1762 | 120 |
if hwRound(Gear^.X) > cScreenWidth + LAND_WIDTH then Gear^.X:= int2hwFloat(-cScreenWidth - 256) |
803 | 121 |
end; |
122 |
||
1041 | 123 |
procedure doStepExpl(Gear: PVisualGear; Steps: Longword); |
124 |
begin |
|
1046 | 125 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
1041 | 126 |
|
1046 | 127 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
128 |
//Gear^.dY:= Gear^.dY + cGravity; |
|
1041 | 129 |
|
1045 | 130 |
if Gear^.FrameTicks <= Steps then |
131 |
if Gear^.Frame = 0 then DeleteVisualGear(Gear) |
|
132 |
else |
|
133 |
begin |
|
134 |
dec(Gear^.Frame); |
|
135 |
Gear^.FrameTicks:= cExplFrameTicks |
|
136 |
end |
|
137 |
else dec(Gear^.FrameTicks, Steps) |
|
1041 | 138 |
end; |
139 |
||
1046 | 140 |
procedure doStepFire(Gear: PVisualGear; Steps: Longword); |
141 |
begin |
|
142 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
143 |
||
144 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravity * (Steps * Steps); |
|
145 |
Gear^.dY:= Gear^.dY + cGravity * Steps; |
|
146 |
||
147 |
if Gear^.FrameTicks <= Steps then |
|
148 |
DeleteVisualGear(Gear) |
|
149 |
else |
|
150 |
dec(Gear^.FrameTicks, Steps) |
|
151 |
end; |
|
152 |
||
1505 | 153 |
procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword); |
154 |
begin |
|
155 |
Gear^.Y:= Gear^.Y - _0_02 * Steps; |
|
156 |
||
157 |
if Gear^.FrameTicks <= Steps then |
|
158 |
DeleteVisualGear(Gear) |
|
159 |
else |
|
160 |
dec(Gear^.FrameTicks, Steps) |
|
161 |
end; |
|
162 |
||
803 | 163 |
// ================================================================== |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
164 |
const doStepHandlers: array[TVisualGearType] of TVGearStepProcedure = |
1505 | 165 |
( |
166 |
@doStepFlake, |
|
167 |
@doStepCloud, |
|
168 |
@doStepExpl, |
|
169 |
@doStepExpl, |
|
170 |
@doStepFire, |
|
171 |
@doStepSmallDamage |
|
172 |
); |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
173 |
|
805 | 174 |
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
175 |
var Result: PVisualGear; |
1045 | 176 |
t: Longword; |
177 |
sp: hwFloat; |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
178 |
begin |
1642 | 179 |
if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then // we're scrolling now |
180 |
if Kind <> vgtCloud then |
|
181 |
begin |
|
182 |
AddVisualGear:= nil; |
|
183 |
exit |
|
184 |
end; |
|
185 |
||
1812 | 186 |
if cReducedQuality then |
187 |
begin |
|
188 |
AddVisualGear:= nil; |
|
189 |
exit |
|
190 |
end; |
|
191 |
||
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
192 |
New(Result); |
812
cbc392576990
Fix memory corrupt due to wrong parameter in sizeof()
unc0rr
parents:
808
diff
changeset
|
193 |
FillChar(Result^, sizeof(TVisualGear), 0); |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
194 |
Result^.X:= int2hwFloat(X); |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
195 |
Result^.Y:= int2hwFloat(Y); |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
196 |
Result^.Kind := Kind; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
197 |
Result^.doStep:= doStepHandlers[Kind]; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
198 |
|
1505 | 199 |
with Result^ do |
200 |
case Kind of |
|
201 |
vgtFlake: begin |
|
202 |
FrameTicks:= random(vobFrameTicks); |
|
203 |
Frame:= random(vobFramesCount); |
|
204 |
Angle:= random * 360; |
|
205 |
dx.isNegative:= random(2) = 0; |
|
206 |
dx.QWordValue:= random(100000000); |
|
207 |
dy.isNegative:= false; |
|
208 |
dy.QWordValue:= random(70000000); |
|
209 |
dAngle:= (random(2) * 2 - 1) * (1 + random) * vobVelocity / 1000 |
|
210 |
end; |
|
211 |
vgtCloud: begin |
|
212 |
Frame:= random(4); |
|
213 |
dx.isNegative:= random(2) = 0; |
|
214 |
dx.QWordValue:= random(214748364); |
|
215 |
dy.isNegative:= random(2) = 0; |
|
216 |
dy.QWordValue:= 21474836 + random(64424509); |
|
217 |
mdY:= dy.QWordValue |
|
218 |
end; |
|
219 |
vgtExplPart, |
|
220 |
vgtExplPart2: begin |
|
221 |
t:= random(1024); |
|
222 |
sp:= _0_001 * (random(95) + 70); |
|
223 |
dx:= AngleSin(t) * sp; |
|
224 |
dx.isNegative:= random(2) = 0; |
|
225 |
dy:= AngleCos(t) * sp; |
|
226 |
dy.isNegative:= random(2) = 0; |
|
227 |
Frame:= 7 - random(3); |
|
228 |
FrameTicks:= cExplFrameTicks |
|
229 |
end; |
|
230 |
vgtFire: begin |
|
231 |
t:= random(1024); |
|
232 |
sp:= _0_001 * (random(85) + 95); |
|
233 |
dx:= AngleSin(t) * sp; |
|
234 |
dx.isNegative:= random(2) = 0; |
|
235 |
dy:= AngleCos(t) * sp; |
|
236 |
dy.isNegative:= random(2) = 0; |
|
237 |
FrameTicks:= 650 + random(250); |
|
238 |
Frame:= random(8) |
|
239 |
end; |
|
240 |
vgtSmallDamageTag: begin |
|
241 |
Result^.FrameTicks:= 1100 |
|
242 |
end; |
|
243 |
end; |
|
803 | 244 |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
245 |
if VisualGearsList <> nil then |
1505 | 246 |
begin |
247 |
VisualGearsList^.PrevGear:= Result; |
|
248 |
Result^.NextGear:= VisualGearsList |
|
249 |
end; |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
250 |
VisualGearsList:= Result; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
251 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
252 |
AddVisualGear:= Result |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
253 |
end; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
254 |
|
1041 | 255 |
procedure DeleteVisualGear(Gear: PVisualGear); |
256 |
begin |
|
1505 | 257 |
if Gear^.Tex <> nil then |
258 |
FreeTexture(Gear^.Tex); |
|
259 |
||
1041 | 260 |
if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear; |
261 |
if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear |
|
262 |
else VisualGearsList:= Gear^.NextGear; |
|
263 |
||
264 |
Dispose(Gear) |
|
265 |
end; |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
266 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
267 |
procedure ProcessVisualGears(Steps: Longword); |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
268 |
var Gear, t: PVisualGear; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
269 |
begin |
803 | 270 |
if Steps = 0 then exit; |
271 |
||
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
272 |
t:= VisualGearsList; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
273 |
while t <> nil do |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
274 |
begin |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
275 |
Gear:= t; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
276 |
t:= Gear^.NextGear; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
277 |
Gear^.doStep(Gear, Steps) |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
278 |
end |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
279 |
end; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
280 |
|
1045 | 281 |
procedure DrawVisualGears(Layer: LongWord); |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
282 |
var Gear: PVisualGear; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
283 |
begin |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
284 |
Gear:= VisualGearsList; |
1045 | 285 |
case Layer of |
286 |
0: while Gear <> nil do |
|
287 |
begin |
|
288 |
case Gear^.Kind of |
|
289 |
vgtFlake: if vobVelocity = 0 then |
|
290 |
DrawSprite(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame) |
|
291 |
else |
|
292 |
DrawRotatedF(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); |
|
293 |
vgtCloud: DrawSprite(sprCloud, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame); |
|
294 |
end; |
|
295 |
Gear:= Gear^.NextGear |
|
296 |
end; |
|
297 |
1: while Gear <> nil do |
|
298 |
begin |
|
299 |
case Gear^.Kind of |
|
300 |
vgtExplPart: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 7 - Gear^.Frame); |
|
1047 | 301 |
vgtExplPart2: DrawSprite(sprExplPart2, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 7 - Gear^.Frame); |
1046 | 302 |
vgtFire: DrawSprite(sprFlame, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (RealTicks div 64 + Gear^.Frame) mod 8); |
1505 | 303 |
vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex); |
1045 | 304 |
end; |
305 |
Gear:= Gear^.NextGear |
|
306 |
end |
|
307 |
end |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
308 |
end; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
309 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
310 |
procedure AddClouds; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
311 |
var i: LongInt; |
803 | 312 |
begin |
1132 | 313 |
for i:= 0 to cCloudsNumber - 1 do |
1801 | 314 |
AddVisualGear( - cScreenWidth + i * ((cScreenWidth * 2 + (LAND_WIDTH+256)) div (cCloudsNumber + 1)), LAND_HEIGHT-1184, vgtCloud) |
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
315 |
end; |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
316 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
317 |
initialization |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
318 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
319 |
finalization |
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
320 |
|
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff
changeset
|
321 |
end. |