author | sheepluva |
Tue, 01 Feb 2011 19:49:10 +0100 | |
changeset 4901 | d1e2d82d9ccc |
parent 4883 | 7cddc9201a1d |
child 4913 | f0d48df35f86 |
permissions | -rw-r--r-- |
4388 | 1 |
{$INCLUDE "options.inc"} |
2 |
unit uGearsRender; |
|
3 |
||
4 |
interface |
|
5 |
uses uTypes, uConsts, GLunit, uFloat; |
|
6 |
||
7 |
procedure RenderGear(Gear: PGear; x, y: LongInt); |
|
8 |
||
9 |
var RopePoints: record |
|
10 |
Count: Longword; |
|
11 |
HookAngle: GLfloat; |
|
12 |
ar: array[0..MAXROPEPOINTS] of record |
|
13 |
X, Y: hwFloat; |
|
14 |
dLen: hwFloat; |
|
15 |
b: boolean; |
|
16 |
end; |
|
17 |
rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f; |
|
18 |
end; |
|
19 |
||
20 |
implementation |
|
21 |
uses uRender, uUtils, uVariables, uAmmos, Math; |
|
22 |
||
23 |
procedure DrawRopeLinesRQ(Gear: PGear); |
|
24 |
begin |
|
25 |
with RopePoints do |
|
26 |
begin |
|
27 |
rounded[Count].X:= hwRound(Gear^.X); |
|
28 |
rounded[Count].Y:= hwRound(Gear^.Y); |
|
29 |
rounded[Count + 1].X:= hwRound(Gear^.Hedgehog^.Gear^.X); |
|
30 |
rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y); |
|
31 |
end; |
|
32 |
||
33 |
if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then |
|
34 |
begin |
|
35 |
glDisable(GL_TEXTURE_2D); |
|
36 |
//glEnable(GL_LINE_SMOOTH); |
|
37 |
||
38 |
glPushMatrix; |
|
39 |
||
40 |
glTranslatef(WorldDx, WorldDy, 0); |
|
41 |
||
42 |
glLineWidth(4.0); |
|
43 |
||
44 |
Tint($C0, $C0, $C0, $FF); |
|
45 |
||
46 |
glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]); |
|
47 |
glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2); |
|
48 |
Tint($FF, $FF, $FF, $FF); |
|
49 |
||
50 |
glPopMatrix; |
|
51 |
||
52 |
glEnable(GL_TEXTURE_2D); |
|
53 |
//glDisable(GL_LINE_SMOOTH) |
|
54 |
end |
|
55 |
end; |
|
56 |
||
57 |
||
58 |
procedure DrawRope(Gear: PGear); |
|
59 |
var roplen: LongInt; |
|
60 |
i: Longword; |
|
61 |
||
62 |
procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt); |
|
63 |
var eX, eY, dX, dY: LongInt; |
|
64 |
i, sX, sY, x, y, d: LongInt; |
|
65 |
b: boolean; |
|
66 |
begin |
|
67 |
if (X1 = X2) and (Y1 = Y2) then |
|
68 |
begin |
|
69 |
//OutError('WARNING: zero length rope line!', false); |
|
70 |
exit |
|
71 |
end; |
|
72 |
eX:= 0; |
|
73 |
eY:= 0; |
|
74 |
dX:= X2 - X1; |
|
75 |
dY:= Y2 - Y1; |
|
76 |
||
77 |
if (dX > 0) then sX:= 1 |
|
78 |
else |
|
79 |
if (dX < 0) then |
|
80 |
begin |
|
81 |
sX:= -1; |
|
82 |
dX:= -dX |
|
83 |
end else sX:= dX; |
|
84 |
||
85 |
if (dY > 0) then sY:= 1 |
|
86 |
else |
|
87 |
if (dY < 0) then |
|
88 |
begin |
|
89 |
sY:= -1; |
|
90 |
dY:= -dY |
|
91 |
end else sY:= dY; |
|
92 |
||
93 |
if (dX > dY) then d:= dX |
|
94 |
else d:= dY; |
|
95 |
||
96 |
x:= X1; |
|
97 |
y:= Y1; |
|
98 |
||
99 |
for i:= 0 to d do |
|
100 |
begin |
|
101 |
inc(eX, dX); |
|
102 |
inc(eY, dY); |
|
103 |
b:= false; |
|
104 |
if (eX > d) then |
|
105 |
begin |
|
106 |
dec(eX, d); |
|
107 |
inc(x, sX); |
|
108 |
b:= true |
|
109 |
end; |
|
110 |
if (eY > d) then |
|
111 |
begin |
|
112 |
dec(eY, d); |
|
113 |
inc(y, sY); |
|
114 |
b:= true |
|
115 |
end; |
|
116 |
if b then |
|
117 |
begin |
|
118 |
inc(roplen); |
|
119 |
if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0) |
|
120 |
end |
|
121 |
end |
|
122 |
end; |
|
123 |
begin |
|
124 |
if (cReducedQuality and rqSimpleRope) <> 0 then |
|
125 |
DrawRopeLinesRQ(Gear) |
|
126 |
else |
|
127 |
begin |
|
128 |
roplen:= 0; |
|
129 |
if RopePoints.Count > 0 then |
|
130 |
begin |
|
131 |
i:= 0; |
|
132 |
while i < Pred(RopePoints.Count) do |
|
133 |
begin |
|
134 |
DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
|
135 |
hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy); |
|
136 |
inc(i) |
|
137 |
end; |
|
138 |
DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
|
139 |
hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); |
|
140 |
DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
|
141 |
hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy); |
|
142 |
end else |
|
143 |
if Gear^.Elasticity.QWordValue > 0 then |
|
144 |
DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
|
145 |
hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy); |
|
146 |
end; |
|
147 |
||
148 |
||
149 |
if RopePoints.Count > 0 then |
|
150 |
DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle) |
|
151 |
else |
|
152 |
if Gear^.Elasticity.QWordValue > 0 then |
|
153 |
DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
154 |
end; |
|
155 |
||
156 |
||
157 |
procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt); |
|
158 |
begin |
|
159 |
with Gear^.Hedgehog^ do |
|
160 |
begin |
|
161 |
if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then |
|
162 |
exit; |
|
163 |
DrawTexture(sx + 16, sy + 16, ropeIconTex); |
|
164 |
DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32); |
|
165 |
end; |
|
166 |
end; |
|
167 |
||
168 |
||
169 |
procedure DrawHH(Gear: PGear; ox, oy: LongInt); |
|
170 |
var i, t: LongInt; |
|
171 |
amt: TAmmoType; |
|
172 |
sign, hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
|
173 |
dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real; // laser, change |
|
174 |
defaultPos, HatVisible: boolean; |
|
175 |
HH: PHedgehog; |
|
176 |
CurWeapon: PAmmo; |
|
177 |
begin |
|
178 |
HH:= Gear^.Hedgehog; |
|
179 |
if HH^.Unplaced then exit; |
|
180 |
m:= 1; |
|
181 |
if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1; |
|
182 |
sx:= ox + 1; // this offset is very common |
|
183 |
sy:= oy - 3; |
|
184 |
sign:= hwSign(Gear^.dX); |
|
185 |
||
186 |
if (Gear^.State and gstHHDeath) <> 0 then |
|
187 |
begin |
|
188 |
DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos); |
|
4810 | 189 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 190 |
DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos + 8); |
191 |
Tint($FF, $FF, $FF, $FF); |
|
192 |
exit |
|
193 |
end |
|
194 |
else if (Gear^.State and gstHHGone) <> 0 then |
|
195 |
begin |
|
196 |
DrawRotatedF(sprTeleport, sx, sy, Gear^.Pos, sign, 0); |
|
197 |
exit |
|
198 |
end; |
|
199 |
||
200 |
defaultPos:= true; |
|
201 |
HatVisible:= false; |
|
202 |
||
203 |
||
204 |
if HH^.Effects[hePoisoned] then |
|
205 |
begin |
|
206 |
Tint($00, $FF, $40, $40); |
|
207 |
DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360); |
|
208 |
Tint($FF, $FF, $FF, $FF) |
|
209 |
end; |
|
210 |
||
211 |
if ((Gear^.State and gstWinner) <> 0) and |
|
212 |
((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then |
|
213 |
begin |
|
214 |
DrawHedgehog(sx, sy, |
|
215 |
sign, |
|
216 |
2, |
|
217 |
0, |
|
218 |
0); |
|
219 |
defaultPos:= false |
|
220 |
end; |
|
221 |
if (Gear^.State and gstDrowning) <> 0 then |
|
222 |
begin |
|
223 |
DrawHedgehog(sx, sy, |
|
224 |
sign, |
|
225 |
1, |
|
226 |
7, |
|
227 |
0); |
|
228 |
defaultPos:= false |
|
229 |
end else |
|
230 |
if (Gear^.State and gstLoser) <> 0 then |
|
231 |
begin |
|
232 |
DrawHedgehog(sx, sy, |
|
233 |
sign, |
|
234 |
2, |
|
235 |
3, |
|
236 |
0); |
|
237 |
defaultPos:= false |
|
238 |
end else |
|
239 |
||
240 |
if (Gear^.State and gstHHDriven) <> 0 then |
|
241 |
begin |
|
242 |
if ((Gear^.State and gstHHThinking) = 0) and |
|
243 |
(ShowCrosshair or ((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtRope))) and |
|
244 |
((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
|
245 |
begin |
|
246 |
(* These calculations are a little complex for a few reasons: |
|
247 |
1: I need to draw the laser from weapon origin to nearest land |
|
248 |
2: I need to start the beam outside the hedgie for attractiveness. |
|
249 |
3: I need to extend the beam beyond land. |
|
250 |
This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. |
|
251 |
*) |
|
252 |
dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle); |
|
253 |
dy:= -Cos(Gear^.Angle * pi / cMaxAngle); |
|
254 |
if cLaserSighting then |
|
255 |
begin |
|
256 |
lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle); |
|
257 |
ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle); |
|
258 |
||
259 |
// ensure we start outside the hedgehog (he's solid after all) |
|
260 |
while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do |
|
261 |
begin |
|
262 |
lx:= lx + dx; |
|
263 |
ly:= ly + dy |
|
264 |
end; |
|
265 |
||
266 |
// add hog's position |
|
267 |
lx:= lx + ox - WorldDx; |
|
268 |
ly:= ly + oy - WorldDy; |
|
269 |
||
270 |
// decrease number of iterations required |
|
271 |
ax:= dx * 4; |
|
272 |
ay:= dy * 4; |
|
273 |
||
274 |
tx:= round(lx); |
|
275 |
ty:= round(ly); |
|
276 |
hx:= tx; |
|
277 |
hy:= ty; |
|
278 |
while ((ty and LAND_HEIGHT_MASK) = 0) and |
|
279 |
((tx and LAND_WIDTH_MASK) = 0) and |
|
280 |
(Land[ty, tx] = 0) do // TODO: check for constant variable instead |
|
281 |
begin |
|
282 |
lx:= lx + ax; |
|
283 |
ly:= ly + ay; |
|
284 |
tx:= round(lx); |
|
285 |
ty:= round(ly) |
|
286 |
end; |
|
287 |
// reached edge of land. assume infinite beam. Extend it way out past camera |
|
288 |
if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then |
|
289 |
begin |
|
290 |
tx:= round(lx + ax * (LAND_WIDTH div 4)); |
|
291 |
ty:= round(ly + ay * (LAND_WIDTH div 4)); |
|
292 |
end; |
|
293 |
||
294 |
//if (abs(lx-tx)>8) or (abs(ly-ty)>8) then |
|
295 |
begin |
|
296 |
DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0); |
|
297 |
end; |
|
298 |
end; |
|
299 |
// draw crosshair |
|
300 |
cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle)); |
|
301 |
cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle)); |
|
302 |
DrawRotatedTex(HH^.Team^.CrosshairTex, |
|
303 |
12, 12, cx + WorldDx, cy + WorldDy, 0, |
|
304 |
sign * (Gear^.Angle * 180.0) / cMaxAngle); |
|
305 |
end; |
|
306 |
hx:= ox + 8 * sign; |
|
307 |
hy:= oy - 2; |
|
308 |
aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
|
309 |
if CurAmmoGear <> nil then |
|
310 |
begin |
|
311 |
case CurAmmoGear^.Kind of |
|
312 |
gtShotgunShot: begin |
|
313 |
if (CurAmmoGear^.State and gstAnimation <> 0) then |
|
314 |
DrawRotated(sprShotgun, hx, hy, sign, aangle) |
|
315 |
else |
|
316 |
DrawRotated(sprHandShotgun, hx, hy, sign, aangle); |
|
317 |
end; |
|
318 |
gtDEagleShot: DrawRotated(sprDEagle, hx, hy, sign, aangle); |
|
319 |
gtSniperRifleShot: begin |
|
320 |
if (CurAmmoGear^.State and gstAnimation <> 0) then |
|
321 |
DrawRotatedF(sprSniperRifle, hx, hy, 1, sign, aangle) |
|
322 |
else |
|
323 |
DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle) |
|
324 |
end; |
|
325 |
gtBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle); |
|
326 |
gtRCPlane: begin |
|
327 |
DrawRotated(sprHandPlane, hx, hy, sign, 0); |
|
328 |
defaultPos:= false |
|
329 |
end; |
|
330 |
gtRope: begin |
|
331 |
if Gear^.X < CurAmmoGear^.X then |
|
332 |
begin |
|
333 |
dAngle:= 0; |
|
334 |
hAngle:= 180; |
|
335 |
i:= 1 |
|
336 |
end else |
|
337 |
begin |
|
338 |
dAngle:= 180; |
|
339 |
hAngle:= 0; |
|
340 |
i:= -1 |
|
341 |
end; |
|
342 |
if ((Gear^.State and gstWinner) = 0) then |
|
343 |
begin |
|
344 |
DrawHedgehog(ox, oy, |
|
345 |
i, |
|
346 |
1, |
|
347 |
0, |
|
348 |
DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); |
|
349 |
with HH^ do |
|
350 |
if (HatTex <> nil) then |
|
351 |
begin |
|
352 |
DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32, |
|
353 |
i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
|
354 |
if HatTex^.w > 64 then |
|
355 |
begin |
|
4810 | 356 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 357 |
DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32, |
358 |
i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
|
359 |
Tint($FF, $FF, $FF, $FF) |
|
360 |
end |
|
361 |
end |
|
362 |
end; |
|
363 |
DrawAltWeapon(Gear, ox, oy); |
|
364 |
defaultPos:= false |
|
365 |
end; |
|
366 |
gtBlowTorch: begin |
|
367 |
DrawRotated(sprBlowTorch, hx, hy, sign, aangle); |
|
368 |
DrawHedgehog(sx, sy, |
|
369 |
sign, |
|
370 |
3, |
|
371 |
HH^.visStepPos div 2, |
|
372 |
0); |
|
373 |
with HH^ do |
|
374 |
if (HatTex <> nil) then |
|
375 |
begin |
|
376 |
DrawTextureF(HatTex, |
|
377 |
1, |
|
378 |
sx, |
|
379 |
sy - 5, |
|
380 |
0, |
|
381 |
sign, |
|
382 |
32, |
|
383 |
32); |
|
384 |
if HatTex^.w > 64 then |
|
385 |
begin |
|
4810 | 386 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 387 |
DrawTextureF(HatTex, |
388 |
1, |
|
389 |
sx, |
|
390 |
sy - 5, |
|
391 |
32, |
|
392 |
sign, |
|
393 |
32, |
|
394 |
32); |
|
395 |
Tint($FF, $FF, $FF, $FF) |
|
396 |
end |
|
397 |
end; |
|
398 |
defaultPos:= false |
|
399 |
end; |
|
400 |
gtShover: DrawRotated(sprHandBaseball, hx, hy, sign, aangle + 180); |
|
401 |
gtFirePunch: begin |
|
402 |
DrawHedgehog(sx, sy, |
|
403 |
sign, |
|
404 |
1, |
|
405 |
4, |
|
406 |
0); |
|
407 |
defaultPos:= false |
|
408 |
end; |
|
409 |
gtPickHammer: begin |
|
410 |
defaultPos:= false; |
|
411 |
dec(sy,20); |
|
412 |
end; |
|
413 |
gtTeleport: defaultPos:= false; |
|
414 |
gtWhip: begin |
|
415 |
DrawRotatedF(sprWhip, |
|
416 |
sx, |
|
417 |
sy, |
|
418 |
1, |
|
419 |
sign, |
|
420 |
0); |
|
421 |
defaultPos:= false |
|
422 |
end; |
|
423 |
gtHammer: begin |
|
424 |
DrawRotatedF(sprHammer, |
|
425 |
sx, |
|
426 |
sy, |
|
427 |
1, |
|
428 |
sign, |
|
429 |
0); |
|
430 |
defaultPos:= false |
|
431 |
end; |
|
432 |
gtResurrector: begin |
|
433 |
DrawRotated(sprHandResurrector, sx, sy, 0, 0); |
|
434 |
defaultPos:= false |
|
435 |
end; |
|
436 |
gtKamikaze: begin |
|
437 |
if CurAmmoGear^.Pos = 0 then |
|
438 |
DrawHedgehog(sx, sy, |
|
439 |
sign, |
|
440 |
1, |
|
441 |
6, |
|
442 |
0) |
|
443 |
else |
|
444 |
DrawRotatedF(sprKamikaze, |
|
445 |
ox, oy, |
|
446 |
CurAmmoGear^.Pos - 1, |
|
447 |
sign, |
|
448 |
aangle); |
|
449 |
defaultPos:= false |
|
450 |
end; |
|
451 |
gtSeduction: begin |
|
452 |
if CurAmmoGear^.Pos >= 6 then |
|
453 |
DrawHedgehog(sx, sy, |
|
454 |
sign, |
|
455 |
2, |
|
456 |
2, |
|
457 |
0) |
|
458 |
else |
|
459 |
begin |
|
460 |
DrawRotatedF(sprDress, |
|
461 |
ox, oy, |
|
462 |
CurAmmoGear^.Pos, |
|
463 |
sign, |
|
464 |
0); |
|
465 |
DrawSprite(sprCensored, ox - 32, oy - 20, 0) |
|
466 |
end; |
|
467 |
defaultPos:= false |
|
468 |
end; |
|
469 |
gtFlamethrower: begin |
|
470 |
DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
471 |
if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex) |
|
472 |
end; |
|
473 |
end; |
|
474 |
||
475 |
case CurAmmoGear^.Kind of |
|
476 |
gtShotgunShot, |
|
477 |
gtDEagleShot, |
|
478 |
gtSniperRifleShot, |
|
479 |
gtShover: begin |
|
480 |
DrawHedgehog(sx, sy, |
|
481 |
sign, |
|
482 |
0, |
|
483 |
4, |
|
484 |
0); |
|
485 |
defaultPos:= false; |
|
486 |
HatVisible:= true |
|
487 |
end |
|
488 |
end |
|
489 |
end else |
|
490 |
||
491 |
if ((Gear^.State and gstHHJumping) <> 0) then |
|
492 |
begin |
|
493 |
DrawHedgehog(sx, sy, |
|
494 |
sign*m, |
|
495 |
1, |
|
496 |
1, |
|
497 |
0); |
|
498 |
HatVisible:= true; |
|
499 |
defaultPos:= false |
|
500 |
end else |
|
501 |
||
502 |
if (Gear^.Message and (gmLeft or gmRight) <> 0) and (not isCursorVisible) then |
|
503 |
begin |
|
504 |
DrawHedgehog(sx, sy, |
|
505 |
sign, |
|
506 |
0, |
|
507 |
HH^.visStepPos div 2, |
|
508 |
0); |
|
509 |
defaultPos:= false; |
|
510 |
HatVisible:= true |
|
511 |
end |
|
512 |
else |
|
513 |
||
514 |
if ((Gear^.State and gstAnimation) <> 0) then |
|
515 |
begin |
|
516 |
if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then |
|
517 |
begin |
|
518 |
Gear^.State:= Gear^.State and not gstAnimation; |
|
519 |
end |
|
520 |
else |
|
521 |
begin |
|
522 |
DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
|
523 |
sx, |
|
524 |
sy, |
|
525 |
Gear^.Pos, |
|
526 |
sign, |
|
527 |
0.0); |
|
528 |
defaultPos:= false |
|
529 |
end |
|
530 |
end |
|
531 |
else |
|
532 |
if ((Gear^.State and gstAttacked) = 0) then |
|
533 |
begin |
|
534 |
if HH^.Timer > 0 then |
|
535 |
begin |
|
536 |
// There must be a tidier way to do this. Anyone? |
|
537 |
if aangle <= 90 then aangle:= aangle+360; |
|
538 |
if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*HH^.Timer/10) |
|
539 |
else aangle:= aangle+((240-aangle)*HH^.Timer/10); |
|
540 |
dec(HH^.Timer) |
|
541 |
end; |
|
542 |
amt:= CurrentHedgehog^.CurAmmoType; |
|
543 |
CurWeapon:= GetAmmoEntry(HH^); |
|
544 |
case amt of |
|
545 |
amBazooka: DrawRotated(sprHandBazooka, hx, hy, sign, aangle); |
|
4578 | 546 |
amSnowball: DrawRotated(sprHandSnowball, hx, hy, sign, aangle); |
4388 | 547 |
amMortar: DrawRotated(sprHandMortar, hx, hy, sign, aangle); |
548 |
amMolotov: DrawRotated(sprHandMolotov, hx, hy, sign, aangle); |
|
549 |
amBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle); |
|
550 |
amDrill: DrawRotated(sprHandDrill, hx, hy, sign, aangle); |
|
551 |
amRope: DrawRotated(sprHandRope, hx, hy, sign, aangle); |
|
552 |
amShotgun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle); |
|
553 |
amDEagle: DrawRotated(sprHandDEagle, hx, hy, sign, aangle); |
|
554 |
amSineGun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle); |
|
555 |
amPortalGun: if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer? |
|
556 |
DrawRotatedF(sprPortalGun, hx, hy, 0, sign, aangle) |
|
557 |
else |
|
4790 | 558 |
DrawRotatedF(sprPortalGun, hx, hy, 1+CurWeapon^.Pos, sign, aangle); |
4388 | 559 |
amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle); |
560 |
amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, sign, aangle); |
|
561 |
amCake: DrawRotated(sprHandCake, hx, hy, sign, aangle); |
|
562 |
amGrenade: DrawRotated(sprHandGrenade, hx, hy, sign, aangle); |
|
563 |
amWatermelon: DrawRotated(sprHandMelon, hx, hy, sign, aangle); |
|
564 |
amSkip: DrawRotated(sprHandSkip, hx, hy, sign, aangle); |
|
565 |
amClusterBomb: DrawRotated(sprHandCluster, hx, hy, sign, aangle); |
|
566 |
amDynamite: DrawRotated(sprHandDynamite, hx, hy, sign, aangle); |
|
567 |
amHellishBomb: DrawRotated(sprHandHellish, hx, hy, sign, aangle); |
|
568 |
amGasBomb: DrawRotated(sprHandCheese, hx, hy, sign, aangle); |
|
569 |
amMine: DrawRotated(sprHandMine, hx, hy, sign, aangle); |
|
570 |
amSMine: DrawRotated(sprHandSMine, hx, hy, sign, aangle); |
|
571 |
amSeduction: DrawRotated(sprHandSeduction, hx, hy, sign, aangle); |
|
572 |
amVampiric: DrawRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
573 |
amRCPlane: begin |
|
574 |
DrawRotated(sprHandPlane, hx, hy, sign, 0); |
|
575 |
defaultPos:= false |
|
576 |
end; |
|
577 |
amGirder: begin |
|
578 |
DrawRotated(sprHandConstruction, hx, hy, sign, aangle); |
|
579 |
DrawSpriteClipped(sprGirder, |
|
580 |
ox-256, |
|
581 |
oy-256, |
|
582 |
LongInt(topY)+WorldDy, |
|
583 |
LongInt(rightX)+WorldDx, |
|
584 |
cWaterLine+WorldDy, |
|
585 |
LongInt(leftX)+WorldDx) |
|
586 |
end; |
|
587 |
amBee: DrawRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
588 |
amFlamethrower: DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
589 |
amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here |
|
590 |
end; |
|
591 |
||
592 |
case amt of |
|
593 |
amAirAttack, |
|
594 |
amMineStrike, |
|
595 |
amDrillStrike: DrawRotated(sprHandAirAttack, sx, oy, sign, 0); |
|
596 |
amPickHammer: DrawHedgehog(sx, sy, |
|
597 |
sign, |
|
598 |
1, |
|
599 |
2, |
|
600 |
0); |
|
601 |
amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, sign, 0); |
|
602 |
amKamikaze: DrawHedgehog(sx, sy, |
|
603 |
sign, |
|
604 |
1, |
|
605 |
5, |
|
606 |
0); |
|
607 |
amWhip: DrawRotatedF(sprWhip, |
|
608 |
sx, |
|
609 |
sy, |
|
610 |
0, |
|
611 |
sign, |
|
612 |
0); |
|
613 |
amHammer: DrawRotatedF(sprHammer, |
|
614 |
sx, |
|
615 |
sy, |
|
616 |
0, |
|
617 |
sign, |
|
618 |
0); |
|
619 |
else |
|
620 |
DrawHedgehog(sx, sy, |
|
621 |
sign, |
|
622 |
0, |
|
623 |
4, |
|
624 |
0); |
|
625 |
||
626 |
HatVisible:= true; |
|
627 |
(* with HH^ do |
|
628 |
if (HatTex <> nil) |
|
629 |
and (HatVisibility > 0) then |
|
630 |
DrawTextureF(HatTex, |
|
631 |
HatVisibility, |
|
632 |
sx, |
|
633 |
sy - 5, |
|
634 |
0, |
|
635 |
sign, |
|
636 |
32, |
|
637 |
32); *) |
|
638 |
end; |
|
639 |
||
640 |
case amt of |
|
641 |
amBaseballBat: DrawRotated(sprHandBaseball, |
|
642 |
sx - 4 * sign, |
|
643 |
sy + 9, sign, aangle); |
|
644 |
end; |
|
645 |
||
646 |
defaultPos:= false |
|
647 |
end; |
|
648 |
||
649 |
end else // not gstHHDriven |
|
650 |
begin |
|
651 |
if (Gear^.Damage > 0) |
|
652 |
and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
|
653 |
begin |
|
654 |
DrawHedgehog(sx, sy, |
|
655 |
sign, |
|
656 |
2, |
|
657 |
1, |
|
658 |
Gear^.DirAngle); |
|
659 |
defaultPos:= false |
|
660 |
end else |
|
661 |
||
662 |
if ((Gear^.State and gstHHJumping) <> 0) then |
|
663 |
begin |
|
664 |
DrawHedgehog(sx, sy, |
|
665 |
sign*m, |
|
666 |
1, |
|
667 |
1, |
|
668 |
0); |
|
669 |
defaultPos:= false |
|
670 |
end; |
|
671 |
end; |
|
672 |
||
673 |
with HH^ do |
|
674 |
begin |
|
675 |
if defaultPos then |
|
676 |
begin |
|
677 |
DrawRotatedF(sprHHIdle, |
|
678 |
sx, |
|
679 |
sy, |
|
680 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
681 |
sign, |
|
682 |
0); |
|
683 |
HatVisible:= true; |
|
684 |
end; |
|
685 |
||
686 |
if HatVisible then |
|
687 |
if HatVisibility < 1.0 then |
|
688 |
HatVisibility:= HatVisibility + 0.2 |
|
689 |
else |
|
690 |
else |
|
691 |
if HatVisibility > 0.0 then |
|
692 |
HatVisibility:= HatVisibility - 0.2; |
|
693 |
||
694 |
if (HatTex <> nil) |
|
695 |
and (HatVisibility > 0) then |
|
696 |
if DefaultPos then |
|
697 |
begin |
|
698 |
DrawTextureF(HatTex, |
|
699 |
HatVisibility, |
|
700 |
sx, |
|
701 |
sy - 5, |
|
702 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
703 |
sign, |
|
704 |
32, |
|
705 |
32); |
|
706 |
if HatTex^.w > 64 then |
|
707 |
begin |
|
4810 | 708 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 709 |
DrawTextureF(HatTex, |
710 |
HatVisibility, |
|
711 |
sx, |
|
712 |
sy - 5, |
|
713 |
(RealTicks div 128 + Gear^.Pos) mod 19 + 32, |
|
714 |
sign, |
|
715 |
32, |
|
716 |
32); |
|
717 |
Tint($FF, $FF, $FF, $FF) |
|
718 |
end |
|
719 |
end |
|
720 |
else |
|
721 |
begin |
|
722 |
DrawTextureF(HatTex, |
|
723 |
HatVisibility, |
|
724 |
sx, |
|
725 |
sy - 5, |
|
726 |
0, |
|
727 |
sign*m, |
|
728 |
32, |
|
729 |
32); |
|
730 |
if HatTex^.w > 64 then |
|
731 |
begin |
|
4810 | 732 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 733 |
DrawTextureF(HatTex, |
734 |
HatVisibility, |
|
735 |
sx, |
|
736 |
sy - 5, |
|
737 |
32, |
|
738 |
sign*m, |
|
739 |
32, |
|
740 |
32); |
|
741 |
Tint($FF, $FF, $FF, $FF) |
|
742 |
end |
|
743 |
end |
|
744 |
end; |
|
745 |
if (Gear^.State and gstHHDriven) <> 0 then |
|
746 |
begin |
|
747 |
(* if (CurAmmoGear = nil) then |
|
748 |
begin |
|
749 |
amt:= CurrentHedgehog^.CurAmmoType; |
|
750 |
case amt of |
|
751 |
amJetpack: DrawSprite(sprJetpack, sx-32, sy-32, 0); |
|
752 |
end |
|
753 |
end; *) |
|
754 |
if CurAmmoGear <> nil then |
|
755 |
begin |
|
756 |
case CurAmmoGear^.Kind of |
|
757 |
gtJetpack: begin |
|
758 |
DrawSprite(sprJetpack, sx-32, sy-32, 0); |
|
759 |
if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then |
|
760 |
begin |
|
761 |
if (CurAmmoGear^.MsgParam and gmUp) <> 0 then DrawSprite(sprJetpack, sx-32, sy-28, 1); |
|
762 |
if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then DrawSprite(sprJetpack, sx-28, sy-28, 2); |
|
763 |
if (CurAmmoGear^.MsgParam and gmRight) <> 0 then DrawSprite(sprJetpack, sx-36, sy-28, 3) |
|
764 |
end; |
|
765 |
if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex); |
|
766 |
DrawAltWeapon(Gear, sx, sy) |
|
767 |
end; |
|
768 |
end; |
|
769 |
end |
|
770 |
end; |
|
771 |
||
772 |
with HH^ do |
|
773 |
begin |
|
774 |
if ((Gear^.State and not gstWinner) = 0) |
|
775 |
or ((Gear^.State = gstWait) and (Gear^.dY.QWordValue = 0)) |
|
776 |
or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
|
777 |
begin |
|
778 |
t:= sy - cHHRadius - 9; |
|
779 |
if (cTagsMask and htTransparent) <> 0 then |
|
780 |
Tint($FF, $FF, $FF, $80); |
|
781 |
if ((cTagsMask and htHealth) <> 0) then |
|
782 |
begin |
|
783 |
dec(t, HealthTagTex^.h + 2); |
|
784 |
DrawCentered(ox, t, HealthTagTex) |
|
785 |
end; |
|
786 |
if (cTagsMask and htName) <> 0 then |
|
787 |
begin |
|
788 |
dec(t, NameTagTex^.h + 2); |
|
789 |
DrawCentered(ox, t, NameTagTex) |
|
790 |
end; |
|
791 |
if (cTagsMask and htTeamName) <> 0 then |
|
792 |
begin |
|
793 |
dec(t, Team^.NameTagTex^.h + 2); |
|
794 |
DrawCentered(ox, t, Team^.NameTagTex) |
|
795 |
end; |
|
796 |
if (cTagsMask and htTransparent) <> 0 then |
|
797 |
Tint($FF, $FF, $FF, $FF) |
|
798 |
end; |
|
799 |
if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
|
800 |
begin |
|
4394 | 801 |
if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtResurrector) then |
802 |
DrawCentered(ox, sy - cHHRadius - 7 - HealthTagTex^.h, HealthTagTex); |
|
803 |
||
4388 | 804 |
if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
805 |
DrawSprite(sprFinger, ox - 16, oy - 64, |
|
806 |
GameTicks div 32 mod 16); |
|
807 |
||
808 |
if (Gear^.State and gstDrowning) = 0 then |
|
809 |
if (Gear^.State and gstHHThinking) <> 0 then |
|
810 |
DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8) |
|
811 |
end |
|
812 |
end; |
|
813 |
||
814 |
if HH^.Effects[hePoisoned] then |
|
815 |
begin |
|
816 |
Tint($00, $FF, $40, $80); |
|
817 |
DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360); |
|
818 |
end; |
|
819 |
if HH^.Effects[heResurrected] then |
|
820 |
begin |
|
821 |
Tint($f5, $db, $35, $20); |
|
822 |
DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
|
823 |
end; |
|
824 |
||
825 |
if Gear^.Invulnerable then |
|
826 |
begin |
|
827 |
Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); |
|
828 |
DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
|
829 |
end; |
|
830 |
if cVampiric and |
|
831 |
(CurrentHedgehog^.Gear <> nil) and |
|
832 |
(CurrentHedgehog^.Gear = Gear) then |
|
833 |
begin |
|
834 |
Tint($FF, 0, 0, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
|
835 |
DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
|
836 |
end; |
|
837 |
Tint($FF, $FF, $FF, $FF) |
|
838 |
end; |
|
839 |
||
840 |
||
841 |
procedure RenderGear(Gear: PGear; x, y: LongInt); |
|
842 |
var |
|
843 |
HHGear: PGear; |
|
844 |
i: Longword; |
|
845 |
startX, endX, startY, endY: LongInt; |
|
846 |
begin |
|
847 |
case Gear^.Kind of |
|
848 |
gtBomb: DrawRotated(sprBomb, x, y, 0, Gear^.DirAngle); |
|
4578 | 849 |
gtSnowball: DrawRotated(sprSnowball, x, y, 0, Gear^.DirAngle); |
4388 | 850 |
gtGasBomb: DrawRotated(sprCheese, x, y, 0, Gear^.DirAngle); |
851 |
gtMolotov: DrawRotated(sprMolotov, x, y, 0, Gear^.DirAngle); |
|
852 |
||
853 |
gtRCPlane: begin |
|
854 |
if (Gear^.Tag = -1) then |
|
855 |
DrawRotated(sprPlane, x, y, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) |
|
856 |
else |
|
857 |
DrawRotated(sprPlane, x, y,0,DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
858 |
end; |
|
859 |
gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle); |
|
860 |
||
861 |
gtPortal: if ((Gear^.Tag and 1) = 0) // still moving? |
|
862 |
or (Gear^.IntersectGear = nil) or (Gear^.IntersectGear^.IntersectGear <> Gear) // not linked&backlinked? |
|
863 |
or ((Gear^.IntersectGear^.Tag and 1) = 0) then // linked portal still moving? |
|
864 |
DrawRotatedf(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle) |
|
865 |
else DrawRotatedf(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle); |
|
866 |
||
867 |
gtDrill: if (Gear^.State and gsttmpFlag) <> 0 then |
|
868 |
DrawRotated(sprAirDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)) |
|
869 |
else |
|
870 |
DrawRotated(sprDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
871 |
||
872 |
gtHedgehog: DrawHH(Gear, x, y); |
|
873 |
||
874 |
gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
875 |
||
876 |
gtGrave: begin |
|
877 |
DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32); |
|
878 |
if Gear^.Health > 0 then |
|
879 |
begin |
|
880 |
//Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750)))); |
|
881 |
Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health))))); |
|
882 |
//Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
|
883 |
DrawSprite(sprVampiric, x - 24, y - 24, 0); |
|
884 |
Tint($FF, $FF, $FF, $FF) |
|
885 |
end |
|
886 |
end; |
|
887 |
gtBee: DrawRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
888 |
gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0); |
|
889 |
gtRope: DrawRope(Gear); |
|
890 |
gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
|
891 |
DrawRotated(sprMineOff, x, y, 0, Gear^.DirAngle) |
|
892 |
else if Gear^.Health <> 0 then DrawRotated(sprMineOn, x, y, 0, Gear^.DirAngle) |
|
893 |
else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
|
894 |
gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
|
895 |
DrawRotated(sprSMineOff, x, y, 0, Gear^.DirAngle) |
|
896 |
else if Gear^.Health <> 0 then DrawRotated(sprSMineOn, x, y, 0, Gear^.DirAngle) |
|
897 |
else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
|
898 |
gtCase: case Gear^.Pos of |
|
899 |
posCaseAmmo : begin |
|
900 |
i:= (GameTicks shr 6) mod 64; |
|
901 |
if i > 18 then i:= 0; |
|
902 |
DrawSprite(sprCase, x - 24, y - 24, i); |
|
903 |
end; |
|
904 |
posCaseHealth: begin |
|
905 |
i:= ((GameTicks shr 6) + 38) mod 64; |
|
906 |
if i > 13 then i:= 0; |
|
907 |
DrawSprite(sprFAid, x - 24, y - 24, i); |
|
908 |
end; |
|
909 |
posCaseUtility: begin |
|
910 |
i:= (GameTicks shr 6) mod 70; |
|
911 |
if i > 23 then i:= 0; |
|
912 |
i:= i mod 12; |
|
913 |
DrawSprite(sprUtility, x - 24, y - 24, i); |
|
914 |
end; |
|
915 |
end; |
|
916 |
gtExplosives: begin |
|
917 |
if ((Gear^.State and gstDrowning) <> 0) then |
|
918 |
DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0) |
|
919 |
else if Gear^.State and gstAnimation = 0 then |
|
920 |
begin |
|
921 |
i:= (GameTicks shr 6 + Gear^.uid*3) mod 64; |
|
922 |
if i > 18 then i:= 0; |
|
923 |
DrawSprite(sprExplosives, x - 24, y - 24, i) |
|
924 |
end |
|
925 |
else if Gear^.State and gsttmpFlag = 0 then |
|
926 |
DrawRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle) |
|
927 |
else |
|
928 |
DrawRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle); |
|
929 |
end; |
|
930 |
gtDynamite: DrawSprite2(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1); |
|
931 |
gtClusterBomb: DrawRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle); |
|
932 |
gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0); |
|
933 |
gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16); |
|
934 |
gtParachute: begin |
|
935 |
DrawSprite(sprParachute, x - 24, y - 48, 0); |
|
936 |
DrawAltWeapon(Gear, x + 1, y - 3) |
|
937 |
end; |
|
938 |
gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 0) |
|
939 |
else DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 1); |
|
940 |
gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
941 |
gtTeleport: begin |
|
942 |
HHGear:= Gear^.Hedgehog^.Gear; |
|
943 |
if not Gear^.Hedgehog^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); |
|
944 |
DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
945 |
end; |
|
946 |
gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12); |
|
947 |
gtTarget: begin |
|
948 |
Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000)); |
|
949 |
DrawSprite(sprTarget, x - 16, y - 16, 0); |
|
950 |
Tint($FF, $FF, $FF, $FF); |
|
951 |
end; |
|
952 |
gtMortar: DrawRotated(sprMortar, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
953 |
gtCake: if Gear^.Pos = 6 then |
|
954 |
DrawRotatedf(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
|
955 |
else |
|
956 |
DrawRotatedf(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90); |
|
957 |
gtSeduction: if Gear^.Pos >= 14 then DrawSprite(sprSeduction, x - 16, y - 16, 0); |
|
958 |
gtWatermelon: DrawRotatedf(sprWatermelon, x, y, 0, 0, Gear^.DirAngle); |
|
959 |
gtMelonPiece: DrawRotatedf(sprWatermelon, x, y, 1, 0, Gear^.DirAngle); |
|
960 |
gtHellishBomb: DrawRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle); |
|
961 |
gtBirdy: begin |
|
962 |
if Gear^.State and gstAnimation = gstAnimation then |
|
963 |
begin |
|
964 |
if Gear^.State and gstTmpFlag = 0 then // Appearing |
|
965 |
begin |
|
966 |
endX:= x - WorldDx; |
|
967 |
endY:= y - WorldDy; |
|
968 |
if Gear^.Tag < 0 then |
|
969 |
startX:= max(LAND_WIDTH + 1024, endX + 2048) |
|
970 |
else |
|
971 |
startX:= max(-LAND_WIDTH - 1024, endX - 2048); |
|
972 |
startY:= endY - 256; |
|
973 |
DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + round((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1)), startY + WorldDy + round((endY - startY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); |
|
974 |
end |
|
975 |
else // Disappearing |
|
976 |
begin |
|
977 |
startX:= x - WorldDx; |
|
978 |
startY:= y - WorldDy; |
|
979 |
if Gear^.Tag > 0 then |
|
980 |
endX:= max(LAND_WIDTH + 1024, startX + 2048) |
|
981 |
else |
|
982 |
endX:= max(-LAND_WIDTH - 1024, startX - 2048); |
|
983 |
endY:= startY + 256; |
|
984 |
DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + round((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + round((endY - startY) * cos(LongInt(Gear^.Timer)/2000 * (Pi/2)) - (endY - startY)) + hwRound(Gear^.dY * Gear^.Timer), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); |
|
985 |
end; |
|
986 |
end |
|
987 |
else |
|
988 |
DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); |
|
989 |
end; |
|
990 |
gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, x, y, 0, 1, 16, 16, Gear^.DirAngle); |
|
991 |
gtPiano: begin |
|
992 |
if (Gear^.State and gstDrowning) = 0 then |
|
993 |
begin |
|
994 |
Tint($FF, $FF, $FF, $10); |
|
995 |
for i:= 8 downto 1 do |
|
996 |
DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128, 0); |
|
997 |
Tint($FF, $FF, $FF, $FF) |
|
998 |
end; |
|
999 |
DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y, 0, 1, 128, 128, 0); |
|
1000 |
end; |
|
1001 |
gtPoisonCloud: begin |
|
1002 |
if Gear^.Timer < 1020 then |
|
1003 |
Tint($C0, $C0, $00, Gear^.Timer div 8) |
|
1004 |
else if Gear^.Timer > 3980 then |
|
1005 |
Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8) |
|
1006 |
else |
|
1007 |
Tint($C0, $C0, $00, $C0); |
|
1008 |
DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360); |
|
1009 |
Tint($FF, $FF, $FF, $FF) |
|
1010 |
end; |
|
1011 |
gtResurrector: begin |
|
1012 |
DrawRotated(sprCross, x, y, 0, 0); |
|
1013 |
Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000)))); |
|
1014 |
DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5); |
|
1015 |
Tint($FF, $FF, $FF, $FF); |
|
1016 |
end; |
|
1017 |
gtNapalmBomb: DrawRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
4617 | 1018 |
gtFlake: if not isInLag then |
1019 |
begin |
|
1020 |
if vobVelocity = 0 then |
|
1021 |
//DrawSprite(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer) |
|
1022 |
DrawSprite(sprFlake, x, y, Gear^.Timer) |
|
1023 |
else |
|
1024 |
//DrawRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle); |
|
1025 |
DrawRotatedF(sprFlake, x, y, Gear^.Timer, 1, Gear^.DirAngle) |
|
1026 |
end; |
|
4883
7cddc9201a1d
added dummy for tardis and ugly icons for tardis and structure
Henek
parents:
4881
diff
changeset
|
1027 |
gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0); |
4611 | 1028 |
|
4388 | 1029 |
end; |
1030 |
if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(x + 8, y + 8, Gear^.Tex); |
|
1031 |
end; |
|
1032 |
||
1033 |
end. |