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