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