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