author | unc0rr |
Sun, 14 Aug 2011 20:53:52 +0400 | |
changeset 5559 | a937d43a032f |
parent 5528 | c539e5c81870 |
child 5560 | d1ebcf4df330 |
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); |
|
5525 | 603 |
amSeduction: begin |
604 |
DrawRotated(sprHandSeduction, hx, hy, sign, aangle); |
|
5526 | 605 |
DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); |
5525 | 606 |
end; |
4388 | 607 |
amVampiric: DrawRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
608 |
amRCPlane: begin |
|
609 |
DrawRotated(sprHandPlane, hx, hy, sign, 0); |
|
610 |
defaultPos:= false |
|
611 |
end; |
|
612 |
amGirder: begin |
|
613 |
DrawRotated(sprHandConstruction, hx, hy, sign, aangle); |
|
614 |
DrawSpriteClipped(sprGirder, |
|
615 |
ox-256, |
|
616 |
oy-256, |
|
617 |
LongInt(topY)+WorldDy, |
|
618 |
LongInt(rightX)+WorldDx, |
|
619 |
cWaterLine+WorldDy, |
|
620 |
LongInt(leftX)+WorldDx) |
|
621 |
end; |
|
622 |
amBee: DrawRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
623 |
amFlamethrower: DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
|
5024 | 624 |
amLandGun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle); |
4388 | 625 |
amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here |
626 |
end; |
|
627 |
||
628 |
case amt of |
|
629 |
amAirAttack, |
|
630 |
amMineStrike, |
|
631 |
amDrillStrike: DrawRotated(sprHandAirAttack, sx, oy, sign, 0); |
|
632 |
amPickHammer: DrawHedgehog(sx, sy, |
|
633 |
sign, |
|
634 |
1, |
|
635 |
2, |
|
636 |
0); |
|
637 |
amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, sign, 0); |
|
638 |
amKamikaze: DrawHedgehog(sx, sy, |
|
639 |
sign, |
|
640 |
1, |
|
641 |
5, |
|
642 |
0); |
|
643 |
amWhip: DrawRotatedF(sprWhip, |
|
644 |
sx, |
|
645 |
sy, |
|
646 |
0, |
|
647 |
sign, |
|
648 |
0); |
|
649 |
amHammer: DrawRotatedF(sprHammer, |
|
650 |
sx, |
|
651 |
sy, |
|
652 |
0, |
|
653 |
sign, |
|
654 |
0); |
|
655 |
else |
|
656 |
DrawHedgehog(sx, sy, |
|
657 |
sign, |
|
658 |
0, |
|
659 |
4, |
|
660 |
0); |
|
661 |
||
662 |
HatVisible:= true; |
|
663 |
(* with HH^ do |
|
664 |
if (HatTex <> nil) |
|
665 |
and (HatVisibility > 0) then |
|
666 |
DrawTextureF(HatTex, |
|
667 |
HatVisibility, |
|
668 |
sx, |
|
669 |
sy - 5, |
|
670 |
0, |
|
671 |
sign, |
|
672 |
32, |
|
673 |
32); *) |
|
674 |
end; |
|
675 |
||
676 |
case amt of |
|
677 |
amBaseballBat: DrawRotated(sprHandBaseball, |
|
678 |
sx - 4 * sign, |
|
679 |
sy + 9, sign, aangle); |
|
680 |
end; |
|
681 |
||
682 |
defaultPos:= false |
|
683 |
end; |
|
684 |
||
685 |
end else // not gstHHDriven |
|
686 |
begin |
|
687 |
if (Gear^.Damage > 0) |
|
688 |
and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
|
689 |
begin |
|
690 |
DrawHedgehog(sx, sy, |
|
691 |
sign, |
|
692 |
2, |
|
693 |
1, |
|
694 |
Gear^.DirAngle); |
|
695 |
defaultPos:= false |
|
696 |
end else |
|
697 |
||
698 |
if ((Gear^.State and gstHHJumping) <> 0) then |
|
699 |
begin |
|
700 |
DrawHedgehog(sx, sy, |
|
701 |
sign*m, |
|
702 |
1, |
|
703 |
1, |
|
704 |
0); |
|
705 |
defaultPos:= false |
|
706 |
end; |
|
707 |
end; |
|
708 |
||
709 |
with HH^ do |
|
710 |
begin |
|
711 |
if defaultPos then |
|
712 |
begin |
|
713 |
DrawRotatedF(sprHHIdle, |
|
714 |
sx, |
|
715 |
sy, |
|
716 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
717 |
sign, |
|
718 |
0); |
|
719 |
HatVisible:= true; |
|
720 |
end; |
|
721 |
||
722 |
if HatVisible then |
|
723 |
if HatVisibility < 1.0 then |
|
724 |
HatVisibility:= HatVisibility + 0.2 |
|
725 |
else |
|
726 |
else |
|
727 |
if HatVisibility > 0.0 then |
|
728 |
HatVisibility:= HatVisibility - 0.2; |
|
729 |
||
730 |
if (HatTex <> nil) |
|
731 |
and (HatVisibility > 0) then |
|
732 |
if DefaultPos then |
|
733 |
begin |
|
734 |
DrawTextureF(HatTex, |
|
735 |
HatVisibility, |
|
736 |
sx, |
|
737 |
sy - 5, |
|
738 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
739 |
sign, |
|
740 |
32, |
|
741 |
32); |
|
742 |
if HatTex^.w > 64 then |
|
743 |
begin |
|
4810 | 744 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 745 |
DrawTextureF(HatTex, |
746 |
HatVisibility, |
|
747 |
sx, |
|
748 |
sy - 5, |
|
749 |
(RealTicks div 128 + Gear^.Pos) mod 19 + 32, |
|
750 |
sign, |
|
751 |
32, |
|
752 |
32); |
|
753 |
Tint($FF, $FF, $FF, $FF) |
|
754 |
end |
|
755 |
end |
|
756 |
else |
|
757 |
begin |
|
758 |
DrawTextureF(HatTex, |
|
759 |
HatVisibility, |
|
760 |
sx, |
|
761 |
sy - 5, |
|
762 |
0, |
|
763 |
sign*m, |
|
764 |
32, |
|
765 |
32); |
|
766 |
if HatTex^.w > 64 then |
|
767 |
begin |
|
4810 | 768 |
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
4388 | 769 |
DrawTextureF(HatTex, |
770 |
HatVisibility, |
|
771 |
sx, |
|
772 |
sy - 5, |
|
773 |
32, |
|
774 |
sign*m, |
|
775 |
32, |
|
776 |
32); |
|
777 |
Tint($FF, $FF, $FF, $FF) |
|
778 |
end |
|
779 |
end |
|
780 |
end; |
|
781 |
if (Gear^.State and gstHHDriven) <> 0 then |
|
782 |
begin |
|
783 |
(* if (CurAmmoGear = nil) then |
|
784 |
begin |
|
785 |
amt:= CurrentHedgehog^.CurAmmoType; |
|
786 |
case amt of |
|
787 |
amJetpack: DrawSprite(sprJetpack, sx-32, sy-32, 0); |
|
788 |
end |
|
789 |
end; *) |
|
790 |
if CurAmmoGear <> nil then |
|
791 |
begin |
|
792 |
case CurAmmoGear^.Kind of |
|
793 |
gtJetpack: begin |
|
794 |
DrawSprite(sprJetpack, sx-32, sy-32, 0); |
|
795 |
if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then |
|
796 |
begin |
|
797 |
if (CurAmmoGear^.MsgParam and gmUp) <> 0 then DrawSprite(sprJetpack, sx-32, sy-28, 1); |
|
798 |
if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then DrawSprite(sprJetpack, sx-28, sy-28, 2); |
|
799 |
if (CurAmmoGear^.MsgParam and gmRight) <> 0 then DrawSprite(sprJetpack, sx-36, sy-28, 3) |
|
800 |
end; |
|
801 |
if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex); |
|
802 |
DrawAltWeapon(Gear, sx, sy) |
|
803 |
end; |
|
804 |
end; |
|
805 |
end |
|
806 |
end; |
|
807 |
||
808 |
with HH^ do |
|
809 |
begin |
|
810 |
if ((Gear^.State and not gstWinner) = 0) |
|
811 |
or ((Gear^.State = gstWait) and (Gear^.dY.QWordValue = 0)) |
|
812 |
or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
|
813 |
begin |
|
814 |
t:= sy - cHHRadius - 9; |
|
815 |
if (cTagsMask and htTransparent) <> 0 then |
|
816 |
Tint($FF, $FF, $FF, $80); |
|
817 |
if ((cTagsMask and htHealth) <> 0) then |
|
818 |
begin |
|
819 |
dec(t, HealthTagTex^.h + 2); |
|
820 |
DrawCentered(ox, t, HealthTagTex) |
|
821 |
end; |
|
822 |
if (cTagsMask and htName) <> 0 then |
|
823 |
begin |
|
824 |
dec(t, NameTagTex^.h + 2); |
|
825 |
DrawCentered(ox, t, NameTagTex) |
|
826 |
end; |
|
827 |
if (cTagsMask and htTeamName) <> 0 then |
|
828 |
begin |
|
829 |
dec(t, Team^.NameTagTex^.h + 2); |
|
830 |
DrawCentered(ox, t, Team^.NameTagTex) |
|
831 |
end; |
|
832 |
if (cTagsMask and htTransparent) <> 0 then |
|
833 |
Tint($FF, $FF, $FF, $FF) |
|
834 |
end; |
|
835 |
if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
|
836 |
begin |
|
4394 | 837 |
if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtResurrector) then |
838 |
DrawCentered(ox, sy - cHHRadius - 7 - HealthTagTex^.h, HealthTagTex); |
|
839 |
||
4388 | 840 |
if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
841 |
DrawSprite(sprFinger, ox - 16, oy - 64, |
|
842 |
GameTicks div 32 mod 16); |
|
843 |
||
844 |
if (Gear^.State and gstDrowning) = 0 then |
|
845 |
if (Gear^.State and gstHHThinking) <> 0 then |
|
846 |
DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8) |
|
847 |
end |
|
848 |
end; |
|
849 |
||
850 |
if HH^.Effects[hePoisoned] then |
|
851 |
begin |
|
852 |
Tint($00, $FF, $40, $80); |
|
853 |
DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360); |
|
854 |
end; |
|
855 |
if HH^.Effects[heResurrected] then |
|
856 |
begin |
|
857 |
Tint($f5, $db, $35, $20); |
|
858 |
DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
|
859 |
end; |
|
860 |
||
861 |
if Gear^.Invulnerable then |
|
862 |
begin |
|
863 |
Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); |
|
864 |
DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
|
865 |
end; |
|
866 |
if cVampiric and |
|
867 |
(CurrentHedgehog^.Gear <> nil) and |
|
868 |
(CurrentHedgehog^.Gear = Gear) then |
|
869 |
begin |
|
870 |
Tint($FF, 0, 0, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
|
871 |
DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
|
872 |
end; |
|
873 |
Tint($FF, $FF, $FF, $FF) |
|
874 |
end; |
|
875 |
||
876 |
||
877 |
procedure RenderGear(Gear: PGear; x, y: LongInt); |
|
878 |
var |
|
879 |
HHGear: PGear; |
|
880 |
i: Longword; |
|
881 |
startX, endX, startY, endY: LongInt; |
|
882 |
begin |
|
5507
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
883 |
if Gear^.TargetX <> NoPointX then |
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
884 |
if Gear^.AmmoType = amBee then |
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
885 |
DrawRotatedF(sprTargetBee, Gear^.TargetX + WorldDx, Gear^.TargetY + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
886 |
else |
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
887 |
DrawRotatedF(sprTargetP, Gear^.TargetX + WorldDx, Gear^.TargetY + WorldDy, 0, 0, (RealTicks shr 3) mod 360); |
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset
|
888 |
|
4388 | 889 |
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
|
890 |
gtGrenade: DrawRotated(sprBomb, x, y, 0, Gear^.DirAngle); |
4578 | 891 |
gtSnowball: DrawRotated(sprSnowball, x, y, 0, Gear^.DirAngle); |
4388 | 892 |
gtGasBomb: DrawRotated(sprCheese, x, y, 0, Gear^.DirAngle); |
893 |
gtMolotov: DrawRotated(sprMolotov, x, y, 0, Gear^.DirAngle); |
|
894 |
||
895 |
gtRCPlane: begin |
|
896 |
if (Gear^.Tag = -1) then |
|
897 |
DrawRotated(sprPlane, x, y, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) |
|
898 |
else |
|
899 |
DrawRotated(sprPlane, x, y,0,DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
900 |
end; |
|
901 |
gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle); |
|
902 |
||
903 |
gtPortal: if ((Gear^.Tag and 1) = 0) // still moving? |
|
904 |
or (Gear^.IntersectGear = nil) or (Gear^.IntersectGear^.IntersectGear <> Gear) // not linked&backlinked? |
|
905 |
or ((Gear^.IntersectGear^.Tag and 1) = 0) then // linked portal still moving? |
|
906 |
DrawRotatedf(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle) |
|
907 |
else DrawRotatedf(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle); |
|
908 |
||
909 |
gtDrill: if (Gear^.State and gsttmpFlag) <> 0 then |
|
910 |
DrawRotated(sprAirDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)) |
|
911 |
else |
|
912 |
DrawRotated(sprDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
913 |
||
914 |
gtHedgehog: DrawHH(Gear, x, y); |
|
915 |
||
916 |
gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
917 |
||
918 |
gtGrave: begin |
|
919 |
DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32); |
|
920 |
if Gear^.Health > 0 then |
|
921 |
begin |
|
922 |
//Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750)))); |
|
923 |
Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health))))); |
|
924 |
//Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
|
925 |
DrawSprite(sprVampiric, x - 24, y - 24, 0); |
|
926 |
Tint($FF, $FF, $FF, $FF) |
|
927 |
end |
|
928 |
end; |
|
929 |
gtBee: DrawRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
930 |
gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0); |
|
931 |
gtRope: DrawRope(Gear); |
|
932 |
gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
|
933 |
DrawRotated(sprMineOff, x, y, 0, Gear^.DirAngle) |
|
934 |
else if Gear^.Health <> 0 then DrawRotated(sprMineOn, x, y, 0, Gear^.DirAngle) |
|
935 |
else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
|
936 |
gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
|
937 |
DrawRotated(sprSMineOff, x, y, 0, Gear^.DirAngle) |
|
938 |
else if Gear^.Health <> 0 then DrawRotated(sprSMineOn, x, y, 0, Gear^.DirAngle) |
|
939 |
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
|
940 |
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
|
941 |
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
|
942 |
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
|
943 |
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
|
944 |
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
|
945 |
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
|
946 |
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
|
947 |
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
|
948 |
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
|
949 |
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
|
950 |
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
|
951 |
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
|
952 |
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
|
953 |
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
|
954 |
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
|
955 |
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
|
956 |
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
|
957 |
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
|
958 |
end; |
4388 | 959 |
gtExplosives: begin |
960 |
if ((Gear^.State and gstDrowning) <> 0) then |
|
961 |
DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0) |
|
962 |
else if Gear^.State and gstAnimation = 0 then |
|
963 |
begin |
|
964 |
i:= (GameTicks shr 6 + Gear^.uid*3) mod 64; |
|
965 |
if i > 18 then i:= 0; |
|
966 |
DrawSprite(sprExplosives, x - 24, y - 24, i) |
|
967 |
end |
|
968 |
else if Gear^.State and gsttmpFlag = 0 then |
|
969 |
DrawRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle) |
|
970 |
else |
|
971 |
DrawRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle); |
|
972 |
end; |
|
973 |
gtDynamite: DrawSprite2(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1); |
|
974 |
gtClusterBomb: DrawRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle); |
|
975 |
gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0); |
|
976 |
gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16); |
|
977 |
gtParachute: begin |
|
978 |
DrawSprite(sprParachute, x - 24, y - 48, 0); |
|
979 |
DrawAltWeapon(Gear, x + 1, y - 3) |
|
980 |
end; |
|
981 |
gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 0) |
|
982 |
else DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 1); |
|
983 |
gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
984 |
gtTeleport: begin |
|
985 |
HHGear:= Gear^.Hedgehog^.Gear; |
|
986 |
if not Gear^.Hedgehog^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); |
|
987 |
DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
988 |
end; |
|
989 |
gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12); |
|
990 |
gtTarget: begin |
|
991 |
Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000)); |
|
992 |
DrawSprite(sprTarget, x - 16, y - 16, 0); |
|
993 |
Tint($FF, $FF, $FF, $FF); |
|
994 |
end; |
|
995 |
gtMortar: DrawRotated(sprMortar, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
996 |
gtCake: if Gear^.Pos = 6 then |
|
997 |
DrawRotatedf(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
|
998 |
else |
|
999 |
DrawRotatedf(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90); |
|
1000 |
gtSeduction: if Gear^.Pos >= 14 then DrawSprite(sprSeduction, x - 16, y - 16, 0); |
|
1001 |
gtWatermelon: DrawRotatedf(sprWatermelon, x, y, 0, 0, Gear^.DirAngle); |
|
1002 |
gtMelonPiece: DrawRotatedf(sprWatermelon, x, y, 1, 0, Gear^.DirAngle); |
|
1003 |
gtHellishBomb: DrawRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle); |
|
1004 |
gtBirdy: begin |
|
1005 |
if Gear^.State and gstAnimation = gstAnimation then |
|
1006 |
begin |
|
1007 |
if Gear^.State and gstTmpFlag = 0 then // Appearing |
|
1008 |
begin |
|
1009 |
endX:= x - WorldDx; |
|
1010 |
endY:= y - WorldDy; |
|
1011 |
if Gear^.Tag < 0 then |
|
1012 |
startX:= max(LAND_WIDTH + 1024, endX + 2048) |
|
1013 |
else |
|
1014 |
startX:= max(-LAND_WIDTH - 1024, endX - 2048); |
|
1015 |
startY:= endY - 256; |
|
5179
8d64dcb566ea
Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents:
5145
diff
changeset
|
1016 |
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 | 1017 |
end |
1018 |
else // Disappearing |
|
1019 |
begin |
|
1020 |
startX:= x - WorldDx; |
|
1021 |
startY:= y - WorldDy; |
|
1022 |
if Gear^.Tag > 0 then |
|
1023 |
endX:= max(LAND_WIDTH + 1024, startX + 2048) |
|
1024 |
else |
|
1025 |
endX:= max(-LAND_WIDTH - 1024, startX - 2048); |
|
1026 |
endY:= startY + 256; |
|
5179
8d64dcb566ea
Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents:
5145
diff
changeset
|
1027 |
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 | 1028 |
end; |
1029 |
end |
|
1030 |
else |
|
5528
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1031 |
begin |
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1032 |
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
|
1033 |
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
|
1034 |
else |
c539e5c81870
slight visual tweak. birdy's wings beat faster if he's just about tired out
nemo
parents:
5526
diff
changeset
|
1035 |
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
|
1036 |
end; |
4388 | 1037 |
end; |
1038 |
gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, x, y, 0, 1, 16, 16, Gear^.DirAngle); |
|
1039 |
gtPiano: begin |
|
1040 |
if (Gear^.State and gstDrowning) = 0 then |
|
1041 |
begin |
|
1042 |
Tint($FF, $FF, $FF, $10); |
|
1043 |
for i:= 8 downto 1 do |
|
1044 |
DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128, 0); |
|
1045 |
Tint($FF, $FF, $FF, $FF) |
|
1046 |
end; |
|
1047 |
DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y, 0, 1, 128, 128, 0); |
|
1048 |
end; |
|
1049 |
gtPoisonCloud: begin |
|
1050 |
if Gear^.Timer < 1020 then |
|
1051 |
Tint($C0, $C0, $00, Gear^.Timer div 8) |
|
1052 |
else if Gear^.Timer > 3980 then |
|
1053 |
Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8) |
|
1054 |
else |
|
1055 |
Tint($C0, $C0, $00, $C0); |
|
1056 |
DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360); |
|
1057 |
Tint($FF, $FF, $FF, $FF) |
|
1058 |
end; |
|
1059 |
gtResurrector: begin |
|
1060 |
DrawRotated(sprCross, x, y, 0, 0); |
|
1061 |
Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000)))); |
|
1062 |
DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5); |
|
1063 |
Tint($FF, $FF, $FF, $FF); |
|
1064 |
end; |
|
1065 |
gtNapalmBomb: DrawRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
5519 | 1066 |
gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0 then |
5024 | 1067 |
begin |
5041 | 1068 |
Tint((cExplosionBorderColor shr RShift) and $FF, |
1069 |
(cExplosionBorderColor shr GShift) and $FF, |
|
1070 |
(cExplosionBorderColor shr BShift) and $FF, |
|
5461 | 1071 |
$FF); |
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
1072 |
// Needs a nicer white texture to tint |
5472 | 1073 |
DrawRotatedTextureF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle); |
5461 | 1074 |
//DrawRotated(sprSnowDust, x, y, 0, Gear^.DirAngle); |
5472 | 1075 |
//DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1); |
5024 | 1076 |
Tint($FF, $FF, $FF, $FF); |
1077 |
end |
|
1078 |
else if not isInLag then |
|
1079 |
begin |
|
4617 | 1080 |
if vobVelocity = 0 then |
5024 | 1081 |
DrawSprite(sprFlake, x, y, Gear^.Timer) |
1082 |
else |
|
1083 |
DrawRotatedF(sprFlake, x, y, Gear^.Timer, 1, Gear^.DirAngle) |
|
1084 |
//DrawSprite(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer) |
|
1085 |
//DrawRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle); |
|
1086 |
end; |
|
4883
7cddc9201a1d
added dummy for tardis and ugly icons for tardis and structure
Henek
parents:
4881
diff
changeset
|
1087 |
gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0); |
4611 | 1088 |
|
4388 | 1089 |
end; |
1090 |
if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(x + 8, y + 8, Gear^.Tex); |
|
1091 |
end; |
|
1092 |
||
1093 |
end. |