author | unc0rr |
Sat, 03 Sep 2011 21:35:49 +0400 | |
changeset 5747 | 65006a679352 |
parent 5740 | caf10b231b08 |
child 5787 | f2caf41f2984 |
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 |
|
5145
120f4271f197
adjust crosshair criteria again. this should take care of sniper rifle and crosshair after attacking
nemo
parents:
5137
diff
changeset
|
261 |
if ((Gear^.State and (gstHHThinking or gstAnimation)) = 0) and |
5136
948da1e50205
Fix a few crosshair bugs. Disable ShowCrosshair and just decide when drawing.
nemo
parents:
5041
diff
changeset
|
262 |
/// If current ammo is active, and current ammo has alt attack and uses a crosshair (rope, basically, right now, with no crosshair for parachute/saucer |
5145
120f4271f197
adjust crosshair criteria again. this should take care of sniper rifle and crosshair after attacking
nemo
parents:
5137
diff
changeset
|
263 |
(((CurAmmoGear <> nil) and //((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and |
5136
948da1e50205
Fix a few crosshair bugs. Disable ShowCrosshair and just decide when drawing.
nemo
parents:
5041
diff
changeset
|
264 |
((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or |
948da1e50205
Fix a few crosshair bugs. Disable ShowCrosshair and just decide when drawing.
nemo
parents:
5041
diff
changeset
|
265 |
/// If no current ammo is active, and the selected ammo uses a crosshair |
5145
120f4271f197
adjust crosshair criteria again. this should take care of sniper rifle and crosshair after attacking
nemo
parents:
5137
diff
changeset
|
266 |
((CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0) and ((Gear^.State and gstAttacked) = 0))) then |
4388 | 267 |
begin |
268 |
(* These calculations are a little complex for a few reasons: |
|
269 |
1: I need to draw the laser from weapon origin to nearest land |
|
270 |
2: I need to start the beam outside the hedgie for attractiveness. |
|
271 |
3: I need to extend the beam beyond land. |
|
272 |
This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. |
|
273 |
*) |
|
274 |
dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle); |
|
275 |
dy:= -Cos(Gear^.Angle * pi / cMaxAngle); |
|
276 |
if cLaserSighting then |
|
277 |
begin |
|
278 |
lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle); |
|
279 |
ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle); |
|
280 |
||
281 |
// ensure we start outside the hedgehog (he's solid after all) |
|
282 |
while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do |
|
283 |
begin |
|
284 |
lx:= lx + dx; |
|
285 |
ly:= ly + dy |
|
286 |
end; |
|
287 |
||
288 |
// add hog's position |
|
289 |
lx:= lx + ox - WorldDx; |
|
290 |
ly:= ly + oy - WorldDy; |
|
291 |
||
292 |
// decrease number of iterations required |
|
293 |
ax:= dx * 4; |
|
294 |
ay:= dy * 4; |
|
295 |
||
296 |
tx:= round(lx); |
|
297 |
ty:= round(ly); |
|
298 |
hx:= tx; |
|
299 |
hy:= ty; |
|
300 |
while ((ty and LAND_HEIGHT_MASK) = 0) and |
|
301 |
((tx and LAND_WIDTH_MASK) = 0) and |
|
302 |
(Land[ty, tx] = 0) do // TODO: check for constant variable instead |
|
303 |
begin |
|
304 |
lx:= lx + ax; |
|
305 |
ly:= ly + ay; |
|
306 |
tx:= round(lx); |
|
307 |
ty:= round(ly) |
|
308 |
end; |
|
309 |
// reached edge of land. assume infinite beam. Extend it way out past camera |
|
310 |
if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then |
|
311 |
begin |
|
312 |
tx:= round(lx + ax * (LAND_WIDTH div 4)); |
|
313 |
ty:= round(ly + ay * (LAND_WIDTH div 4)); |
|
314 |
end; |
|
315 |
||
316 |
//if (abs(lx-tx)>8) or (abs(ly-ty)>8) then |
|
317 |
begin |
|
318 |
DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0); |
|
319 |
end; |
|
320 |
end; |
|
321 |
// draw crosshair |
|
322 |
cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle)); |
|
323 |
cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle)); |
|
324 |
DrawRotatedTex(HH^.Team^.CrosshairTex, |
|
325 |
12, 12, cx + WorldDx, cy + WorldDy, 0, |
|
326 |
sign * (Gear^.Angle * 180.0) / cMaxAngle); |
|
327 |
end; |
|
328 |
hx:= ox + 8 * sign; |
|
329 |
hy:= oy - 2; |
|
330 |
aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
|
331 |
if CurAmmoGear <> nil then |
|
332 |
begin |
|
333 |
case CurAmmoGear^.Kind of |
|
334 |
gtShotgunShot: begin |
|
335 |
if (CurAmmoGear^.State and gstAnimation <> 0) then |
|
336 |
DrawRotated(sprShotgun, hx, hy, sign, aangle) |
|
337 |
else |
|
338 |
DrawRotated(sprHandShotgun, hx, hy, sign, aangle); |
|
339 |
end; |
|
340 |
gtDEagleShot: DrawRotated(sprDEagle, hx, hy, sign, aangle); |
|
341 |
gtSniperRifleShot: begin |
|
342 |
if (CurAmmoGear^.State and gstAnimation <> 0) then |
|
343 |
DrawRotatedF(sprSniperRifle, hx, hy, 1, sign, aangle) |
|
344 |
else |
|
345 |
DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle) |
|
346 |
end; |
|
347 |
gtBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle); |
|
348 |
gtRCPlane: begin |
|
349 |
DrawRotated(sprHandPlane, hx, hy, sign, 0); |
|
350 |
defaultPos:= false |
|
351 |
end; |
|
352 |
gtRope: begin |
|
353 |
if Gear^.X < CurAmmoGear^.X then |
|
354 |
begin |
|
355 |
dAngle:= 0; |
|
356 |
hAngle:= 180; |
|
357 |
i:= 1 |
|
358 |
end else |
|
359 |
begin |
|
360 |
dAngle:= 180; |
|
361 |
hAngle:= 0; |
|
362 |
i:= -1 |
|
363 |
end; |
|
364 |
if ((Gear^.State and gstWinner) = 0) then |
|
365 |
begin |
|
366 |
DrawHedgehog(ox, oy, |
|
367 |
i, |
|
368 |
1, |
|
369 |
0, |
|
370 |
DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); |
|
371 |
with HH^ do |
|
372 |
if (HatTex <> nil) then |
|
373 |
begin |
|
374 |
DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32, |
|
375 |
i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
|
376 |
if HatTex^.w > 64 then |
|
377 |
begin |
|
4810 | 378 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 379 |
DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32, |
380 |
i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
|
381 |
Tint($FF, $FF, $FF, $FF) |
|
382 |
end |
|
383 |
end |
|
384 |
end; |
|
385 |
DrawAltWeapon(Gear, ox, oy); |
|
386 |
defaultPos:= false |
|
387 |
end; |
|
388 |
gtBlowTorch: begin |
|
389 |
DrawRotated(sprBlowTorch, hx, hy, sign, aangle); |
|
390 |
DrawHedgehog(sx, sy, |
|
391 |
sign, |
|
392 |
3, |
|
393 |
HH^.visStepPos div 2, |
|
394 |
0); |
|
395 |
with HH^ do |
|
396 |
if (HatTex <> nil) then |
|
397 |
begin |
|
398 |
DrawTextureF(HatTex, |
|
399 |
1, |
|
400 |
sx, |
|
401 |
sy - 5, |
|
402 |
0, |
|
403 |
sign, |
|
404 |
32, |
|
405 |
32); |
|
406 |
if HatTex^.w > 64 then |
|
407 |
begin |
|
4810 | 408 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 409 |
DrawTextureF(HatTex, |
410 |
1, |
|
411 |
sx, |
|
412 |
sy - 5, |
|
413 |
32, |
|
414 |
sign, |
|
415 |
32, |
|
416 |
32); |
|
417 |
Tint($FF, $FF, $FF, $FF) |
|
418 |
end |
|
419 |
end; |
|
420 |
defaultPos:= false |
|
421 |
end; |
|
422 |
gtShover: DrawRotated(sprHandBaseball, hx, hy, sign, aangle + 180); |
|
423 |
gtFirePunch: begin |
|
424 |
DrawHedgehog(sx, sy, |
|
425 |
sign, |
|
426 |
1, |
|
427 |
4, |
|
428 |
0); |
|
429 |
defaultPos:= false |
|
430 |
end; |
|
431 |
gtPickHammer: begin |
|
432 |
defaultPos:= false; |
|
433 |
dec(sy,20); |
|
434 |
end; |
|
435 |
gtTeleport: defaultPos:= false; |
|
436 |
gtWhip: begin |
|
437 |
DrawRotatedF(sprWhip, |
|
438 |
sx, |
|
439 |
sy, |
|
440 |
1, |
|
441 |
sign, |
|
442 |
0); |
|
443 |
defaultPos:= false |
|
444 |
end; |
|
445 |
gtHammer: begin |
|
446 |
DrawRotatedF(sprHammer, |
|
447 |
sx, |
|
448 |
sy, |
|
449 |
1, |
|
450 |
sign, |
|
451 |
0); |
|
452 |
defaultPos:= false |
|
453 |
end; |
|
454 |
gtResurrector: begin |
|
455 |
DrawRotated(sprHandResurrector, sx, sy, 0, 0); |
|
456 |
defaultPos:= false |
|
457 |
end; |
|
458 |
gtKamikaze: begin |
|
459 |
if CurAmmoGear^.Pos = 0 then |
|
460 |
DrawHedgehog(sx, sy, |
|
461 |
sign, |
|
462 |
1, |
|
463 |
6, |
|
464 |
0) |
|
465 |
else |
|
466 |
DrawRotatedF(sprKamikaze, |
|
467 |
ox, oy, |
|
468 |
CurAmmoGear^.Pos - 1, |
|
469 |
sign, |
|
470 |
aangle); |
|
471 |
defaultPos:= false |
|
472 |
end; |
|
473 |
gtSeduction: begin |
|
474 |
if CurAmmoGear^.Pos >= 6 then |
|
475 |
DrawHedgehog(sx, sy, |
|
476 |
sign, |
|
477 |
2, |
|
478 |
2, |
|
479 |
0) |
|
480 |
else |
|
481 |
begin |
|
482 |
DrawRotatedF(sprDress, |
|
483 |
ox, oy, |
|
484 |
CurAmmoGear^.Pos, |
|
485 |
sign, |
|
486 |
0); |
|
487 |
DrawSprite(sprCensored, ox - 32, oy - 20, 0) |
|
488 |
end; |
|
489 |
defaultPos:= false |
|
490 |
end; |
|
491 |
gtFlamethrower: begin |
|
492 |
DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
493 |
if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex) |
|
494 |
end; |
|
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
495 |
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
|
496 |
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
|
497 |
end; |
4388 | 498 |
end; |
499 |
||
500 |
case CurAmmoGear^.Kind of |
|
501 |
gtShotgunShot, |
|
502 |
gtDEagleShot, |
|
503 |
gtSniperRifleShot, |
|
504 |
gtShover: begin |
|
505 |
DrawHedgehog(sx, sy, |
|
506 |
sign, |
|
507 |
0, |
|
508 |
4, |
|
509 |
0); |
|
510 |
defaultPos:= false; |
|
511 |
HatVisible:= true |
|
512 |
end |
|
513 |
end |
|
514 |
end else |
|
515 |
||
516 |
if ((Gear^.State and gstHHJumping) <> 0) then |
|
517 |
begin |
|
518 |
DrawHedgehog(sx, sy, |
|
519 |
sign*m, |
|
520 |
1, |
|
521 |
1, |
|
522 |
0); |
|
523 |
HatVisible:= true; |
|
524 |
defaultPos:= false |
|
525 |
end else |
|
526 |
||
527 |
if (Gear^.Message and (gmLeft or gmRight) <> 0) and (not isCursorVisible) then |
|
528 |
begin |
|
529 |
DrawHedgehog(sx, sy, |
|
530 |
sign, |
|
531 |
0, |
|
532 |
HH^.visStepPos div 2, |
|
533 |
0); |
|
534 |
defaultPos:= false; |
|
535 |
HatVisible:= true |
|
536 |
end |
|
537 |
else |
|
538 |
||
539 |
if ((Gear^.State and gstAnimation) <> 0) then |
|
540 |
begin |
|
541 |
if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then |
|
542 |
begin |
|
543 |
Gear^.State:= Gear^.State and not gstAnimation; |
|
544 |
end |
|
545 |
else |
|
546 |
begin |
|
547 |
DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
|
548 |
sx, |
|
549 |
sy, |
|
550 |
Gear^.Pos, |
|
551 |
sign, |
|
552 |
0.0); |
|
553 |
defaultPos:= false |
|
554 |
end |
|
555 |
end |
|
556 |
else |
|
557 |
if ((Gear^.State and gstAttacked) = 0) then |
|
558 |
begin |
|
559 |
if HH^.Timer > 0 then |
|
560 |
begin |
|
561 |
// There must be a tidier way to do this. Anyone? |
|
562 |
if aangle <= 90 then aangle:= aangle+360; |
|
563 |
if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*HH^.Timer/10) |
|
564 |
else aangle:= aangle+((240-aangle)*HH^.Timer/10); |
|
565 |
dec(HH^.Timer) |
|
566 |
end; |
|
567 |
amt:= CurrentHedgehog^.CurAmmoType; |
|
568 |
CurWeapon:= GetAmmoEntry(HH^); |
|
569 |
case amt of |
|
570 |
amBazooka: DrawRotated(sprHandBazooka, hx, hy, sign, aangle); |
|
4578 | 571 |
amSnowball: DrawRotated(sprHandSnowball, hx, hy, sign, aangle); |
4388 | 572 |
amMortar: DrawRotated(sprHandMortar, hx, hy, sign, aangle); |
573 |
amMolotov: DrawRotated(sprHandMolotov, hx, hy, sign, aangle); |
|
574 |
amBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle); |
|
575 |
amDrill: DrawRotated(sprHandDrill, hx, hy, sign, aangle); |
|
576 |
amRope: DrawRotated(sprHandRope, hx, hy, sign, aangle); |
|
577 |
amShotgun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle); |
|
578 |
amDEagle: DrawRotated(sprHandDEagle, hx, hy, sign, aangle); |
|
5179
8d64dcb566ea
Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents:
5145
diff
changeset
|
579 |
amSineGun: DrawRotatedF(sprHandSinegun, hx, hy, 73 + (sign * LongInt(RealTicks div 73)) mod 8, sign, aangle); |
4388 | 580 |
amPortalGun: if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer? |
581 |
DrawRotatedF(sprPortalGun, hx, hy, 0, sign, aangle) |
|
582 |
else |
|
4790 | 583 |
DrawRotatedF(sprPortalGun, hx, hy, 1+CurWeapon^.Pos, sign, aangle); |
4388 | 584 |
amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle); |
585 |
amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, sign, aangle); |
|
586 |
amCake: DrawRotated(sprHandCake, hx, hy, sign, aangle); |
|
587 |
amGrenade: DrawRotated(sprHandGrenade, hx, hy, sign, aangle); |
|
588 |
amWatermelon: DrawRotated(sprHandMelon, hx, hy, sign, aangle); |
|
589 |
amSkip: DrawRotated(sprHandSkip, hx, hy, sign, aangle); |
|
590 |
amClusterBomb: DrawRotated(sprHandCluster, hx, hy, sign, aangle); |
|
591 |
amDynamite: DrawRotated(sprHandDynamite, hx, hy, sign, aangle); |
|
592 |
amHellishBomb: DrawRotated(sprHandHellish, hx, hy, sign, aangle); |
|
593 |
amGasBomb: DrawRotated(sprHandCheese, hx, hy, sign, aangle); |
|
594 |
amMine: DrawRotated(sprHandMine, hx, hy, sign, aangle); |
|
595 |
amSMine: DrawRotated(sprHandSMine, hx, hy, sign, aangle); |
|
5525 | 596 |
amSeduction: begin |
597 |
DrawRotated(sprHandSeduction, hx, hy, sign, aangle); |
|
5561
dfbe55237c64
Shrink number of circle points to 60, reenable seduction circle (no longer crashes)
nemo
parents:
5560
diff
changeset
|
598 |
DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); |
dfbe55237c64
Shrink number of circle points to 60, reenable seduction circle (no longer crashes)
nemo
parents:
5560
diff
changeset
|
599 |
//Tint($FF, $0, $0, $AA); |
dfbe55237c64
Shrink number of circle points to 60, reenable seduction circle (no longer crashes)
nemo
parents:
5560
diff
changeset
|
600 |
//DrawTexture(ox - 240, oy - 240, SpritesData[sprVampiric].Texture, 10); |
dfbe55237c64
Shrink number of circle points to 60, reenable seduction circle (no longer crashes)
nemo
parents:
5560
diff
changeset
|
601 |
//Tint($FF, $FF, $FF, $FF); |
5525 | 602 |
end; |
4388 | 603 |
amVampiric: DrawRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
604 |
amRCPlane: begin |
|
605 |
DrawRotated(sprHandPlane, hx, hy, sign, 0); |
|
606 |
defaultPos:= false |
|
607 |
end; |
|
608 |
amGirder: begin |
|
609 |
DrawRotated(sprHandConstruction, hx, hy, sign, aangle); |
|
610 |
DrawSpriteClipped(sprGirder, |
|
611 |
ox-256, |
|
612 |
oy-256, |
|
613 |
LongInt(topY)+WorldDy, |
|
614 |
LongInt(rightX)+WorldDx, |
|
615 |
cWaterLine+WorldDy, |
|
616 |
LongInt(leftX)+WorldDx) |
|
617 |
end; |
|
618 |
amBee: DrawRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
619 |
amFlamethrower: DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
5024 | 620 |
amLandGun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle); |
4388 | 621 |
amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here |
622 |
end; |
|
623 |
||
624 |
case amt of |
|
625 |
amAirAttack, |
|
626 |
amMineStrike, |
|
627 |
amDrillStrike: DrawRotated(sprHandAirAttack, sx, oy, sign, 0); |
|
628 |
amPickHammer: DrawHedgehog(sx, sy, |
|
629 |
sign, |
|
630 |
1, |
|
631 |
2, |
|
632 |
0); |
|
633 |
amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, sign, 0); |
|
634 |
amKamikaze: DrawHedgehog(sx, sy, |
|
635 |
sign, |
|
636 |
1, |
|
637 |
5, |
|
638 |
0); |
|
639 |
amWhip: DrawRotatedF(sprWhip, |
|
640 |
sx, |
|
641 |
sy, |
|
642 |
0, |
|
643 |
sign, |
|
644 |
0); |
|
645 |
amHammer: DrawRotatedF(sprHammer, |
|
646 |
sx, |
|
647 |
sy, |
|
648 |
0, |
|
649 |
sign, |
|
650 |
0); |
|
651 |
else |
|
652 |
DrawHedgehog(sx, sy, |
|
653 |
sign, |
|
654 |
0, |
|
655 |
4, |
|
656 |
0); |
|
657 |
||
658 |
HatVisible:= true; |
|
659 |
(* with HH^ do |
|
660 |
if (HatTex <> nil) |
|
661 |
and (HatVisibility > 0) then |
|
662 |
DrawTextureF(HatTex, |
|
663 |
HatVisibility, |
|
664 |
sx, |
|
665 |
sy - 5, |
|
666 |
0, |
|
667 |
sign, |
|
668 |
32, |
|
669 |
32); *) |
|
670 |
end; |
|
671 |
||
672 |
case amt of |
|
673 |
amBaseballBat: DrawRotated(sprHandBaseball, |
|
674 |
sx - 4 * sign, |
|
675 |
sy + 9, sign, aangle); |
|
676 |
end; |
|
677 |
||
678 |
defaultPos:= false |
|
679 |
end; |
|
680 |
||
681 |
end else // not gstHHDriven |
|
682 |
begin |
|
683 |
if (Gear^.Damage > 0) |
|
684 |
and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
|
685 |
begin |
|
686 |
DrawHedgehog(sx, sy, |
|
687 |
sign, |
|
688 |
2, |
|
689 |
1, |
|
690 |
Gear^.DirAngle); |
|
691 |
defaultPos:= false |
|
692 |
end else |
|
693 |
||
694 |
if ((Gear^.State and gstHHJumping) <> 0) then |
|
695 |
begin |
|
696 |
DrawHedgehog(sx, sy, |
|
697 |
sign*m, |
|
698 |
1, |
|
699 |
1, |
|
700 |
0); |
|
701 |
defaultPos:= false |
|
702 |
end; |
|
703 |
end; |
|
704 |
||
705 |
with HH^ do |
|
706 |
begin |
|
707 |
if defaultPos then |
|
708 |
begin |
|
709 |
DrawRotatedF(sprHHIdle, |
|
710 |
sx, |
|
711 |
sy, |
|
712 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
713 |
sign, |
|
714 |
0); |
|
715 |
HatVisible:= true; |
|
716 |
end; |
|
717 |
||
718 |
if HatVisible then |
|
719 |
if HatVisibility < 1.0 then |
|
720 |
HatVisibility:= HatVisibility + 0.2 |
|
721 |
else |
|
722 |
else |
|
723 |
if HatVisibility > 0.0 then |
|
724 |
HatVisibility:= HatVisibility - 0.2; |
|
725 |
||
726 |
if (HatTex <> nil) |
|
727 |
and (HatVisibility > 0) then |
|
728 |
if DefaultPos then |
|
729 |
begin |
|
730 |
DrawTextureF(HatTex, |
|
731 |
HatVisibility, |
|
732 |
sx, |
|
733 |
sy - 5, |
|
734 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
735 |
sign, |
|
736 |
32, |
|
737 |
32); |
|
738 |
if HatTex^.w > 64 then |
|
739 |
begin |
|
4810 | 740 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 741 |
DrawTextureF(HatTex, |
742 |
HatVisibility, |
|
743 |
sx, |
|
744 |
sy - 5, |
|
745 |
(RealTicks div 128 + Gear^.Pos) mod 19 + 32, |
|
746 |
sign, |
|
747 |
32, |
|
748 |
32); |
|
749 |
Tint($FF, $FF, $FF, $FF) |
|
750 |
end |
|
751 |
end |
|
752 |
else |
|
753 |
begin |
|
754 |
DrawTextureF(HatTex, |
|
755 |
HatVisibility, |
|
756 |
sx, |
|
757 |
sy - 5, |
|
758 |
0, |
|
759 |
sign*m, |
|
760 |
32, |
|
761 |
32); |
|
762 |
if HatTex^.w > 64 then |
|
763 |
begin |
|
4810 | 764 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 765 |
DrawTextureF(HatTex, |
766 |
HatVisibility, |
|
767 |
sx, |
|
768 |
sy - 5, |
|
769 |
32, |
|
770 |
sign*m, |
|
771 |
32, |
|
772 |
32); |
|
773 |
Tint($FF, $FF, $FF, $FF) |
|
774 |
end |
|
775 |
end |
|
776 |
end; |
|
777 |
if (Gear^.State and gstHHDriven) <> 0 then |
|
778 |
begin |
|
779 |
(* if (CurAmmoGear = nil) then |
|
780 |
begin |
|
781 |
amt:= CurrentHedgehog^.CurAmmoType; |
|
782 |
case amt of |
|
783 |
amJetpack: DrawSprite(sprJetpack, sx-32, sy-32, 0); |
|
784 |
end |
|
785 |
end; *) |
|
786 |
if CurAmmoGear <> nil then |
|
787 |
begin |
|
788 |
case CurAmmoGear^.Kind of |
|
789 |
gtJetpack: begin |
|
790 |
DrawSprite(sprJetpack, sx-32, sy-32, 0); |
|
791 |
if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then |
|
792 |
begin |
|
793 |
if (CurAmmoGear^.MsgParam and gmUp) <> 0 then DrawSprite(sprJetpack, sx-32, sy-28, 1); |
|
794 |
if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then DrawSprite(sprJetpack, sx-28, sy-28, 2); |
|
795 |
if (CurAmmoGear^.MsgParam and gmRight) <> 0 then DrawSprite(sprJetpack, sx-36, sy-28, 3) |
|
796 |
end; |
|
797 |
if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex); |
|
798 |
DrawAltWeapon(Gear, sx, sy) |
|
799 |
end; |
|
800 |
end; |
|
801 |
end |
|
802 |
end; |
|
803 |
||
804 |
with HH^ do |
|
805 |
begin |
|
806 |
if ((Gear^.State and not gstWinner) = 0) |
|
807 |
or ((Gear^.State = gstWait) and (Gear^.dY.QWordValue = 0)) |
|
808 |
or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
|
809 |
begin |
|
810 |
t:= sy - cHHRadius - 9; |
|
811 |
if (cTagsMask and htTransparent) <> 0 then |
|
812 |
Tint($FF, $FF, $FF, $80); |
|
813 |
if ((cTagsMask and htHealth) <> 0) then |
|
814 |
begin |
|
815 |
dec(t, HealthTagTex^.h + 2); |
|
816 |
DrawCentered(ox, t, HealthTagTex) |
|
817 |
end; |
|
818 |
if (cTagsMask and htName) <> 0 then |
|
819 |
begin |
|
820 |
dec(t, NameTagTex^.h + 2); |
|
821 |
DrawCentered(ox, t, NameTagTex) |
|
822 |
end; |
|
823 |
if (cTagsMask and htTeamName) <> 0 then |
|
824 |
begin |
|
825 |
dec(t, Team^.NameTagTex^.h + 2); |
|
826 |
DrawCentered(ox, t, Team^.NameTagTex) |
|
827 |
end; |
|
828 |
if (cTagsMask and htTransparent) <> 0 then |
|
829 |
Tint($FF, $FF, $FF, $FF) |
|
830 |
end; |
|
831 |
if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
|
832 |
begin |
|
4394 | 833 |
if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtResurrector) then |
834 |
DrawCentered(ox, sy - cHHRadius - 7 - HealthTagTex^.h, HealthTagTex); |
|
835 |
||
4388 | 836 |
if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
837 |
DrawSprite(sprFinger, ox - 16, oy - 64, |
|
838 |
GameTicks div 32 mod 16); |
|
839 |
||
840 |
if (Gear^.State and gstDrowning) = 0 then |
|
841 |
if (Gear^.State and gstHHThinking) <> 0 then |
|
842 |
DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8) |
|
843 |
end |
|
844 |
end; |
|
845 |
||
846 |
if HH^.Effects[hePoisoned] then |
|
847 |
begin |
|
848 |
Tint($00, $FF, $40, $80); |
|
849 |
DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360); |
|
850 |
end; |
|
851 |
if HH^.Effects[heResurrected] then |
|
852 |
begin |
|
853 |
Tint($f5, $db, $35, $20); |
|
854 |
DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
|
855 |
end; |
|
856 |
||
857 |
if Gear^.Invulnerable then |
|
858 |
begin |
|
859 |
Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); |
|
860 |
DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
|
861 |
end; |
|
862 |
if cVampiric and |
|
863 |
(CurrentHedgehog^.Gear <> nil) and |
|
864 |
(CurrentHedgehog^.Gear = Gear) then |
|
865 |
begin |
|
866 |
Tint($FF, 0, 0, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
|
867 |
DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
|
868 |
end; |
|
869 |
Tint($FF, $FF, $FF, $FF) |
|
870 |
end; |
|
871 |
||
872 |
||
873 |
procedure RenderGear(Gear: PGear; x, y: LongInt); |
|
874 |
var |
|
875 |
HHGear: PGear; |
|
876 |
i: Longword; |
|
877 |
startX, endX, startY, endY: LongInt; |
|
878 |
begin |
|
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5561
diff
changeset
|
879 |
if Gear^.Target.X <> NoPointX then |
5507
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
880 |
if Gear^.AmmoType = amBee then |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5561
diff
changeset
|
881 |
DrawRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
5507
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
882 |
else |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5561
diff
changeset
|
883 |
DrawRotatedF(sprTargetP, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); |
5507
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
884 |
|
4388 | 885 |
case Gear^.Kind of |
5137
b6140f35735f
rename gtBomb to gtGrenade, nerf grenade from 50 to 47 pending some flag to indicate pixels in Land[] belonging to current hog to avoid throwing grenades into hogs
nemo
parents:
5136
diff
changeset
|
886 |
gtGrenade: DrawRotated(sprBomb, x, y, 0, Gear^.DirAngle); |
4578 | 887 |
gtSnowball: DrawRotated(sprSnowball, x, y, 0, Gear^.DirAngle); |
4388 | 888 |
gtGasBomb: DrawRotated(sprCheese, x, y, 0, Gear^.DirAngle); |
889 |
gtMolotov: DrawRotated(sprMolotov, x, y, 0, Gear^.DirAngle); |
|
890 |
||
891 |
gtRCPlane: begin |
|
892 |
if (Gear^.Tag = -1) then |
|
893 |
DrawRotated(sprPlane, x, y, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) |
|
894 |
else |
|
895 |
DrawRotated(sprPlane, x, y,0,DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
896 |
end; |
|
897 |
gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle); |
|
898 |
||
899 |
gtPortal: if ((Gear^.Tag and 1) = 0) // still moving? |
|
900 |
or (Gear^.IntersectGear = nil) or (Gear^.IntersectGear^.IntersectGear <> Gear) // not linked&backlinked? |
|
901 |
or ((Gear^.IntersectGear^.Tag and 1) = 0) then // linked portal still moving? |
|
902 |
DrawRotatedf(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle) |
|
903 |
else DrawRotatedf(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle); |
|
904 |
||
905 |
gtDrill: if (Gear^.State and gsttmpFlag) <> 0 then |
|
906 |
DrawRotated(sprAirDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)) |
|
907 |
else |
|
908 |
DrawRotated(sprDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
909 |
||
910 |
gtHedgehog: DrawHH(Gear, x, y); |
|
911 |
||
912 |
gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
913 |
||
914 |
gtGrave: begin |
|
915 |
DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32); |
|
916 |
if Gear^.Health > 0 then |
|
917 |
begin |
|
918 |
//Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750)))); |
|
919 |
Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health))))); |
|
920 |
//Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
|
921 |
DrawSprite(sprVampiric, x - 24, y - 24, 0); |
|
922 |
Tint($FF, $FF, $FF, $FF) |
|
923 |
end |
|
924 |
end; |
|
925 |
gtBee: DrawRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
926 |
gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0); |
|
927 |
gtRope: DrawRope(Gear); |
|
928 |
gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
|
929 |
DrawRotated(sprMineOff, x, y, 0, Gear^.DirAngle) |
|
930 |
else if Gear^.Health <> 0 then DrawRotated(sprMineOn, x, y, 0, Gear^.DirAngle) |
|
931 |
else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
|
932 |
gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
|
933 |
DrawRotated(sprSMineOff, x, y, 0, Gear^.DirAngle) |
|
934 |
else if Gear^.Health <> 0 then DrawRotated(sprSMineOn, x, y, 0, Gear^.DirAngle) |
|
935 |
else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
|
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
936 |
gtCase: if ((Gear^.Pos and posCaseAmmo) <> 0) then |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
937 |
begin |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
938 |
i:= (GameTicks shr 6) mod 64; |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
939 |
if i > 18 then i:= 0; |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
940 |
DrawSprite(sprCase, x - 24, y - 24, i); |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
941 |
end |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
942 |
else if ((Gear^.Pos and posCaseHealth) <> 0) then |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
943 |
begin |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
944 |
i:= ((GameTicks shr 6) + 38) mod 64; |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
945 |
if i > 13 then i:= 0; |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
946 |
DrawSprite(sprFAid, x - 24, y - 24, i); |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
947 |
end |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
948 |
else if ((Gear^.Pos and posCaseUtility) <> 0) then |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
949 |
begin |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
950 |
i:= (GameTicks shr 6) mod 70; |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
951 |
if i > 23 then i:= 0; |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
952 |
i:= i mod 12; |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
953 |
DrawSprite(sprUtility, x - 24, y - 24, i); |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5197
diff
changeset
|
954 |
end; |
4388 | 955 |
gtExplosives: begin |
956 |
if ((Gear^.State and gstDrowning) <> 0) then |
|
957 |
DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0) |
|
958 |
else if Gear^.State and gstAnimation = 0 then |
|
959 |
begin |
|
960 |
i:= (GameTicks shr 6 + Gear^.uid*3) mod 64; |
|
961 |
if i > 18 then i:= 0; |
|
962 |
DrawSprite(sprExplosives, x - 24, y - 24, i) |
|
963 |
end |
|
964 |
else if Gear^.State and gsttmpFlag = 0 then |
|
965 |
DrawRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle) |
|
966 |
else |
|
967 |
DrawRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle); |
|
968 |
end; |
|
969 |
gtDynamite: DrawSprite2(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1); |
|
970 |
gtClusterBomb: DrawRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle); |
|
971 |
gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0); |
|
972 |
gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16); |
|
973 |
gtParachute: begin |
|
974 |
DrawSprite(sprParachute, x - 24, y - 48, 0); |
|
975 |
DrawAltWeapon(Gear, x + 1, y - 3) |
|
976 |
end; |
|
977 |
gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 0) |
|
978 |
else DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 1); |
|
979 |
gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
980 |
gtTeleport: begin |
|
981 |
HHGear:= Gear^.Hedgehog^.Gear; |
|
982 |
if not Gear^.Hedgehog^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); |
|
983 |
DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
984 |
end; |
|
985 |
gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12); |
|
986 |
gtTarget: begin |
|
987 |
Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000)); |
|
988 |
DrawSprite(sprTarget, x - 16, y - 16, 0); |
|
989 |
Tint($FF, $FF, $FF, $FF); |
|
990 |
end; |
|
991 |
gtMortar: DrawRotated(sprMortar, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
992 |
gtCake: if Gear^.Pos = 6 then |
|
993 |
DrawRotatedf(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
|
994 |
else |
|
995 |
DrawRotatedf(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90); |
|
996 |
gtSeduction: if Gear^.Pos >= 14 then DrawSprite(sprSeduction, x - 16, y - 16, 0); |
|
997 |
gtWatermelon: DrawRotatedf(sprWatermelon, x, y, 0, 0, Gear^.DirAngle); |
|
998 |
gtMelonPiece: DrawRotatedf(sprWatermelon, x, y, 1, 0, Gear^.DirAngle); |
|
999 |
gtHellishBomb: DrawRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle); |
|
1000 |
gtBirdy: begin |
|
1001 |
if Gear^.State and gstAnimation = gstAnimation then |
|
1002 |
begin |
|
1003 |
if Gear^.State and gstTmpFlag = 0 then // Appearing |
|
1004 |
begin |
|
1005 |
endX:= x - WorldDx; |
|
1006 |
endY:= y - WorldDy; |
|
1007 |
if Gear^.Tag < 0 then |
|
1008 |
startX:= max(LAND_WIDTH + 1024, endX + 2048) |
|
1009 |
else |
|
1010 |
startX:= max(-LAND_WIDTH - 1024, endX - 2048); |
|
1011 |
startY:= endY - 256; |
|
5179
8d64dcb566ea
Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents:
5145
diff
changeset
|
1012 |
DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + LongInt(round((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1))), startY + WorldDy + LongInt(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); |
4388 | 1013 |
end |
1014 |
else // Disappearing |
|
1015 |
begin |
|
1016 |
startX:= x - WorldDx; |
|
1017 |
startY:= y - WorldDy; |
|
1018 |
if Gear^.Tag > 0 then |
|
1019 |
endX:= max(LAND_WIDTH + 1024, startX + 2048) |
|
1020 |
else |
|
1021 |
endX:= max(-LAND_WIDTH - 1024, startX - 2048); |
|
1022 |
endY:= startY + 256; |
|
5179
8d64dcb566ea
Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents:
5145
diff
changeset
|
1023 |
DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + LongInt(round((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1)))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + LongInt(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); |
4388 | 1024 |
end; |
1025 |
end |
|
1026 |
else |
|
5528
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1027 |
begin |
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1028 |
if Gear^.Health < 250 then |
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1029 |
DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 7)) mod 2, Gear^.Tag, 75, 75) |
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1030 |
else |
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1031 |
DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); |
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1032 |
end; |
4388 | 1033 |
end; |
1034 |
gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, x, y, 0, 1, 16, 16, Gear^.DirAngle); |
|
1035 |
gtPiano: begin |
|
1036 |
if (Gear^.State and gstDrowning) = 0 then |
|
1037 |
begin |
|
1038 |
Tint($FF, $FF, $FF, $10); |
|
1039 |
for i:= 8 downto 1 do |
|
1040 |
DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128, 0); |
|
1041 |
Tint($FF, $FF, $FF, $FF) |
|
1042 |
end; |
|
1043 |
DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y, 0, 1, 128, 128, 0); |
|
1044 |
end; |
|
1045 |
gtPoisonCloud: begin |
|
1046 |
if Gear^.Timer < 1020 then |
|
1047 |
Tint($C0, $C0, $00, Gear^.Timer div 8) |
|
1048 |
else if Gear^.Timer > 3980 then |
|
1049 |
Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8) |
|
1050 |
else |
|
1051 |
Tint($C0, $C0, $00, $C0); |
|
1052 |
DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360); |
|
1053 |
Tint($FF, $FF, $FF, $FF) |
|
1054 |
end; |
|
1055 |
gtResurrector: begin |
|
1056 |
DrawRotated(sprCross, x, y, 0, 0); |
|
1057 |
Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000)))); |
|
1058 |
DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5); |
|
1059 |
Tint($FF, $FF, $FF, $FF); |
|
1060 |
end; |
|
1061 |
gtNapalmBomb: DrawRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
5519 | 1062 |
gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0 then |
5024 | 1063 |
begin |
5041 | 1064 |
Tint((cExplosionBorderColor shr RShift) and $FF, |
1065 |
(cExplosionBorderColor shr GShift) and $FF, |
|
1066 |
(cExplosionBorderColor shr BShift) and $FF, |
|
5461 | 1067 |
$FF); |
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
1068 |
// Needs a nicer white texture to tint |
5472 | 1069 |
DrawRotatedTextureF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle); |
5461 | 1070 |
//DrawRotated(sprSnowDust, x, y, 0, Gear^.DirAngle); |
5472 | 1071 |
//DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1); |
5024 | 1072 |
Tint($FF, $FF, $FF, $FF); |
1073 |
end |
|
1074 |
else if not isInLag then |
|
1075 |
begin |
|
4617 | 1076 |
if vobVelocity = 0 then |
5024 | 1077 |
DrawSprite(sprFlake, x, y, Gear^.Timer) |
1078 |
else |
|
1079 |
DrawRotatedF(sprFlake, x, y, Gear^.Timer, 1, Gear^.DirAngle) |
|
1080 |
//DrawSprite(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer) |
|
1081 |
//DrawRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle); |
|
1082 |
end; |
|
4883
7cddc9201a1d
added dummy for tardis and ugly icons for tardis and structure
Henek
parents:
4881
diff
changeset
|
1083 |
gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0); |
5706 | 1084 |
gtTardis: if Gear^.Pos <> 4 then |
1085 |
begin |
|
5740 | 1086 |
if Gear^.Pos = 2 then Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF) |
1087 |
else Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); |
|
1088 |
DrawSprite(sprTardis, x-24, y-63,0); |
|
1089 |
if Gear^.Pos = 2 then Tint($FF, $FF, $FF, $FF) |
|
1090 |
else Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); |
|
1091 |
DrawSprite(sprTardis, x-24, y-63,1); |
|
1092 |
if Gear^.Pos <> 2 then Tint($FF, $FF, $FF, $FF) |
|
1093 |
(* |
|
5728 | 1094 |
Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250)))); |
1095 |
DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25); |
|
1096 |
Tint($FF, $FF, $FF, $FF) |
|
5740 | 1097 |
*) |
5706 | 1098 |
end; |
1099 |
||
4611 | 1100 |
|
4388 | 1101 |
end; |
1102 |
if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(x + 8, y + 8, Gear^.Tex); |
|
1103 |
end; |
|
1104 |
||
1105 |
end. |