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