1 (* |
1 (* |
2 * Hedgewars, a free turn based strategy game |
2 * Hedgewars, a free turn based strategy game |
3 * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com> |
3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
4 * |
4 * |
5 * This program is free software; you can redistribute it and/or modify |
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 |
6 * it under the terms of the GNU General Public License as published by |
7 * the Free Software Foundation; version 2 of the License |
7 * the Free Software Foundation; version 2 of the License |
8 * |
8 * |
9 * This program is distributed in the hope that it will be useful, |
9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. |
12 * GNU General Public License for more details. |
13 * |
13 * |
14 * You should have received a copy of the GNU General Public License |
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 |
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 |
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 *) |
17 *) |
18 |
18 |
19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
20 |
20 |
21 unit uGearsRender; |
21 unit uGearsRender; |
22 |
22 |
23 interface |
23 interface |
24 uses uTypes, uConsts, GLunit, uFloat, SDLh; |
24 uses uTypes, uConsts, GLunit, uFloat, SDLh; |
25 |
25 |
|
26 type |
|
27 Tar = record |
|
28 X, Y: hwFloat; |
|
29 dLen: hwFloat; |
|
30 b : boolean; |
|
31 end; |
|
32 TRopePoints = record |
|
33 Count : Longword; |
|
34 HookAngle : GLfloat; |
|
35 ar : array[0..MAXROPEPOINTS] of Tar; |
|
36 rounded : array[0..MAXROPEPOINTS + 2] of TVertex2f; |
|
37 end; |
26 procedure RenderGear(Gear: PGear; x, y: LongInt); |
38 procedure RenderGear(Gear: PGear; x, y: LongInt); |
|
39 procedure DrawHHOrder(); |
27 |
40 |
28 var RopePoints: record |
41 var RopePoints: record |
29 Count: Longword; |
42 Count: Longword; |
30 HookAngle: GLfloat; |
43 HookAngle: GLfloat; |
31 ar: array[0..MAXROPEPOINTS] of record |
44 ar: array[0..MAXROPEPOINTS] of record |
50 rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y); |
64 rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y); |
51 end; |
65 end; |
52 |
66 |
53 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then |
67 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then |
54 begin |
68 begin |
55 glDisable(GL_TEXTURE_2D); |
69 EnableTexture(false); |
56 //glEnable(GL_LINE_SMOOTH); |
70 //glEnable(GL_LINE_SMOOTH); |
57 |
71 |
58 glPushMatrix; |
72 |
59 |
73 Tint(Gear^.Tint shr 24 div 3, Gear^.Tint shr 16 and $FF div 3, Gear^.Tint shr 8 and $FF div 3, Gear^.Tint and $FF); |
60 glTranslatef(WorldDx, WorldDy, 0); |
74 |
61 |
75 n:= RopePoints.Count + 2; |
62 glLineWidth(4.0); |
76 |
63 |
77 SetVertexPointer(@RopePoints.rounded[0], n); |
64 Tint($C0, $C0, $C0, $FF); |
78 |
65 |
79 openglPushMatrix(); |
66 glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]); |
80 openglTranslatef(WorldDx, WorldDy, 0); |
67 glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2); |
81 |
|
82 glLineWidth(3.0 * cScaleFactor); |
|
83 glDrawArrays(GL_LINE_STRIP, 0, n); |
|
84 Tint(Gear^.Tint); |
|
85 glLineWidth(2.0 * cScaleFactor); |
|
86 glDrawArrays(GL_LINE_STRIP, 0, n); |
|
87 |
68 untint; |
88 untint; |
69 |
89 |
70 glPopMatrix; |
90 openglPopMatrix(); |
71 |
91 |
72 glEnable(GL_TEXTURE_2D); |
92 EnableTexture(true); |
73 //glDisable(GL_LINE_SMOOTH) |
93 //glDisable(GL_LINE_SMOOTH) |
74 end |
94 end |
75 end; |
95 end; |
76 |
96 |
77 |
97 |
193 DrawTexture(sx + 16, sy + 16, ropeIconTex); |
214 DrawTexture(sx + 16, sy + 16, ropeIconTex); |
194 DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32); |
215 DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32); |
195 end; |
216 end; |
196 end; |
217 end; |
197 |
218 |
|
219 procedure DrawHHOrder(); |
|
220 var HHGear: PGear; |
|
221 hh: PHedgehog; |
|
222 c, i, t, x, y, sprH, sprW, fSprOff: LongInt; |
|
223 begin |
|
224 t:= LocalTeam; |
|
225 |
|
226 if not CurrentTeam^.ExtDriven then |
|
227 for i:= 0 to Pred(TeamsCount) do |
|
228 if (TeamsArray[i] = CurrentTeam) then |
|
229 t:= i; |
|
230 |
|
231 if t < 0 then |
|
232 exit; |
|
233 |
|
234 if TeamsArray[t] <> nil then |
|
235 begin |
|
236 sprH:= SpritesData[sprBigDigit].Height; |
|
237 sprW:= SpritesData[sprBigDigit].Width; |
|
238 fSprOff:= sprW div 4 + SpritesData[sprFrame].Width div 4 - 1; // - 1 for overlap to avoid artifacts |
|
239 i:= 0; |
|
240 c:= 0; |
|
241 repeat |
|
242 hh:= @TeamsArray[t]^.Hedgehogs[i]; |
|
243 inc(i); |
|
244 if (hh <> nil) and (hh^.Gear <> nil) then |
|
245 begin |
|
246 inc(c); |
|
247 HHGear:= hh^.Gear; |
|
248 x:= hwRound(HHGear^.X) + WorldDx; |
|
249 y:= hwRound(HHGear^.Y) + WorldDy - 2; |
|
250 DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x - fSprOff, y, 0, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height); |
|
251 DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x + fSprOff, y, 1, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height); |
|
252 DrawTextureF(SpritesData[sprBigDigit].Texture, 0.5, x, y, c, 1, sprW, sprH); |
|
253 if SpeechHogNumber = c then |
|
254 DrawCircle(x, y, 20, 3, 0, $FF, $FF, $80); |
|
255 end; |
|
256 until (i > cMaxHHIndex); |
|
257 end |
|
258 |
|
259 end; |
|
260 |
198 |
261 |
199 procedure DrawHH(Gear: PGear; ox, oy: LongInt); |
262 procedure DrawHH(Gear: PGear; ox, oy: LongInt); |
200 var i, t: LongInt; |
263 var i, t: LongInt; |
201 amt: TAmmoType; |
264 amt: TAmmoType; |
202 sign, hx, hy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
265 sign, hx, hy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
299 if (Gear^.State and gstHHDriven) <> 0 then |
366 if (Gear^.State and gstHHDriven) <> 0 then |
300 begin |
367 begin |
301 if ((Gear^.State and (gstHHThinking or gstAnimation)) = 0) and |
368 if ((Gear^.State and (gstHHThinking or gstAnimation)) = 0) and |
302 /// 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 |
369 /// 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 |
303 (((CurAmmoGear <> nil) and //((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and |
370 (((CurAmmoGear <> nil) and //((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and |
|
371 // don't render crosshair/laser during kamikaze |
|
372 ((CurAmmoGear^.AmmoType <> amKamikaze) or ((Gear^.State and gstAttacking) = 0)) and |
304 ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or |
373 ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or |
305 /// If no current ammo is active, and the selected ammo uses a crosshair |
374 /// If no current ammo is active, and the selected ammo uses a crosshair |
306 ((CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0) and ((Gear^.State and gstAttacked) = 0))) then |
375 ((CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0) and ((Gear^.State and gstAttacked) = 0))) then |
307 begin |
376 begin |
308 (* These calculations are a little complex for a few reasons: |
377 (* These calculations are a little complex for a few reasons: |
414 i, |
483 i, |
415 1, |
484 1, |
416 0, |
485 0, |
417 DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); |
486 DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); |
418 with HH^ do |
487 with HH^ do |
419 if (HatTex <> nil) then |
488 if (curhat <> nil) then |
420 begin |
489 begin |
421 DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32, |
490 DrawTextureRotatedF(curhat, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32, |
422 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
491 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
423 if HatTex^.w > 64 then |
492 if curhat^.w > 64 then |
424 begin |
493 begin |
425 Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
494 Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
426 DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32, |
495 DrawTextureRotatedF(curhat, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32, |
427 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
496 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
428 untint |
497 untint |
429 end |
498 end |
430 end |
499 end |
431 end; |
500 end; |
657 amClusterBomb: DrawSpriteRotated(sprHandCluster, hx, hy, sign, aangle); |
726 amClusterBomb: DrawSpriteRotated(sprHandCluster, hx, hy, sign, aangle); |
658 amDynamite: DrawSpriteRotated(sprHandDynamite, hx, hy, sign, aangle); |
727 amDynamite: DrawSpriteRotated(sprHandDynamite, hx, hy, sign, aangle); |
659 amHellishBomb: DrawSpriteRotated(sprHandHellish, hx, hy, sign, aangle); |
728 amHellishBomb: DrawSpriteRotated(sprHandHellish, hx, hy, sign, aangle); |
660 amGasBomb: DrawSpriteRotated(sprHandCheese, hx, hy, sign, aangle); |
729 amGasBomb: DrawSpriteRotated(sprHandCheese, hx, hy, sign, aangle); |
661 amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle); |
730 amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle); |
|
731 amAirMine: DrawSpriteRotated(sprHandAirMine, hx, hy, sign, aangle); |
662 amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle); |
732 amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle); |
663 amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle); |
733 amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle); |
664 amSeduction: begin |
734 amSeduction: begin |
665 DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle); |
735 DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle); |
666 DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); |
736 DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); |
674 defaultPos:= false |
744 defaultPos:= false |
675 end; |
745 end; |
676 amRubber, |
746 amRubber, |
677 amGirder: begin |
747 amGirder: begin |
678 DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle); |
748 DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle); |
679 if WorldEdge = weWrap then |
749 if cBuildMaxDist = cDefaultBuildMaxDist then |
680 begin |
750 begin |
681 if hwRound(Gear^.X) < leftX+256 then |
751 if WorldEdge = weWrap then |
682 DrawSpriteClipped(sprGirder, |
752 begin |
683 rightX+(ox-leftX)-256, |
753 if hwRound(Gear^.X) < LongInt(leftX) + 256 then |
684 oy-256, |
754 DrawSpriteClipped(sprGirder, |
685 LongInt(topY)+WorldDy, |
755 rightX+(ox-leftX)-256, |
686 LongInt(rightX)+WorldDx, |
756 oy-256, |
687 cWaterLine+WorldDy, |
757 LongInt(topY)+WorldDy, |
688 LongInt(leftX)+WorldDx); |
758 LongInt(rightX)+WorldDx, |
689 if hwRound(Gear^.X) > rightX-256 then |
759 cWaterLine+WorldDy, |
690 DrawSpriteClipped(sprGirder, |
760 LongInt(leftX)+WorldDx); |
691 leftX-(rightX-ox)-256, |
761 if hwRound(Gear^.X) > LongInt(rightX) - 256 then |
692 oy-256, |
762 DrawSpriteClipped(sprGirder, |
693 LongInt(topY)+WorldDy, |
763 leftX-(rightX-ox)-256, |
694 LongInt(rightX)+WorldDx, |
764 oy-256, |
695 cWaterLine+WorldDy, |
765 LongInt(topY)+WorldDy, |
696 LongInt(leftX)+WorldDx) |
766 LongInt(rightX)+WorldDx, |
|
767 cWaterLine+WorldDy, |
|
768 LongInt(leftX)+WorldDx) |
|
769 end; |
|
770 DrawSpriteClipped(sprGirder, |
|
771 ox-256, |
|
772 oy-256, |
|
773 LongInt(topY)+WorldDy, |
|
774 LongInt(rightX)+WorldDx, |
|
775 cWaterLine+WorldDy, |
|
776 LongInt(leftX)+WorldDx) |
|
777 end |
|
778 else if cBuildMaxDist > 0 then |
|
779 begin |
|
780 DrawCircle(hx, hy, cBuildMaxDist, 3, $FF, 0, 0, $80); |
697 end; |
781 end; |
698 DrawSpriteClipped(sprGirder, |
|
699 ox-256, |
|
700 oy-256, |
|
701 LongInt(topY)+WorldDy, |
|
702 LongInt(rightX)+WorldDx, |
|
703 cWaterLine+WorldDy, |
|
704 LongInt(leftX)+WorldDx) |
|
705 end; |
782 end; |
706 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
783 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
707 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
784 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
708 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); |
785 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); |
709 amIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle); |
786 amIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle); |
927 begin |
1008 begin |
928 if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtResurrector) then |
1009 if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtResurrector) then |
929 DrawTextureCentered(ox, sy - cHHRadius - 7 - HealthTagTex^.h, HealthTagTex); |
1010 DrawTextureCentered(ox, sy - cHHRadius - 7 - HealthTagTex^.h, HealthTagTex); |
930 |
1011 |
931 if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
1012 if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
932 DrawSprite(sprFinger, ox - 16, oy - 64, |
1013 begin |
933 GameTicks div 32 mod 16); |
1014 ty := oy - 32; |
|
1015 // move finger higher up if tags are above hog |
|
1016 if (cTagsMask and htTeamName) <> 0 then |
|
1017 ty := ty - Team^.NameTagTex^.h - 2; |
|
1018 if (cTagsMask and htName) <> 0 then |
|
1019 ty := ty - NameTagTex^.h - 2; |
|
1020 if (cTagsMask and htHealth) <> 0 then |
|
1021 ty := ty - HealthTagTex^.h - 2; |
|
1022 tx := ox; |
|
1023 |
|
1024 // don't go offscreen |
|
1025 //tx := round(max(((-cScreenWidth + 16) / cScaleFactor) + SpritesData[sprFinger].Width div 2, min(((cScreenWidth - 16) / cScaleFactor) - SpritesData[sprFinger].Width div 2, tx))); |
|
1026 //ty := round(max(cScreenHeight div 2 - ((cScreenHeight - 16) / cScaleFactor) + SpritesData[sprFinger].Height div 2, min(cScreenHeight div 2 - ((-cScreenHeight + SpritesData[sprFinger].Height) / (cScaleFactor)) - SpritesData[sprFinger].Width div 2 - 96, ty))); |
|
1027 t:= 32;//trunc((SpritesData[sprFinger].Width + t) / cScaleFactor); |
|
1028 tx := min(max(tx, ViewLeftX + t), ViewRightX - t); |
|
1029 t:= 32;//trunc((SpritesData[sprFinger].Height + t) / cScaleFactor); |
|
1030 ty := min(ty, ViewBottomY - 96); |
|
1031 // don't overlap with HH or HH tags |
|
1032 if ty < ViewTopY + t then |
|
1033 begin |
|
1034 if abs(tx - ox) < abs(ty - oy) then |
|
1035 ty:= max(ViewTopY + t, oy + t) |
|
1036 else |
|
1037 ty:= max(ViewTopY + t, ty); |
|
1038 end; |
|
1039 |
|
1040 dAngle := DxDy2Angle(int2hwfloat(ty - oy), int2hwfloat(tx - ox)) + 90; |
|
1041 |
|
1042 DrawSpriteRotatedF(sprFinger, tx, ty, RealTicks div 32 mod 16, 1, dAngle); |
|
1043 end; |
|
1044 |
934 |
1045 |
935 if (Gear^.State and gstDrowning) = 0 then |
1046 if (Gear^.State and gstDrowning) = 0 then |
936 if (Gear^.State and gstHHThinking) <> 0 then |
1047 if (Gear^.State and gstHHThinking) <> 0 then |
937 DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8) |
1048 DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8) |
938 end |
1049 end |
939 end; |
1050 end; |
940 |
1051 |
941 if HH^.Effects[hePoisoned] <> 0 then |
1052 if HH^.Effects[hePoisoned] <> 0 then |
942 begin |
1053 begin |
943 Tint($00, $FF, $40, $80); |
1054 Tint($00, $FF, $40, $80); |
944 DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360); |
1055 DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 5) mod 360); |
945 end; |
1056 end; |
946 if HH^.Effects[heResurrected] <> 0 then |
1057 if HH^.Effects[heResurrected] <> 0 then |
947 begin |
1058 begin |
948 Tint($f5, $db, $35, $20); |
1059 Tint($f5, $db, $35, $20); |
949 DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
1060 DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
1017 else DrawSprite(sprMolotov, x, y, 8); |
1125 else DrawSprite(sprMolotov, x, y, 8); |
1018 |
1126 |
1019 gtRCPlane: begin |
1127 gtRCPlane: begin |
1020 aangle:= Gear^.Angle * 360 / 4096; |
1128 aangle:= Gear^.Angle * 360 / 4096; |
1021 if Gear^.Tag < 0 then aangle:= 360-aangle; |
1129 if Gear^.Tag < 0 then aangle:= 360-aangle; |
1022 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF); |
1130 Tint(Gear^.Tint); |
1023 DrawSpriteRotatedF(sprPlane, x, y, 0, Gear^.Tag, aangle - 90); |
1131 DrawSpriteRotatedF(sprPlane, x, y, 0, Gear^.Tag, aangle - 90); |
1024 untint; |
1132 untint; |
1025 DrawSpriteRotatedF(sprPlane, x, y, 1, Gear^.Tag, aangle - 90) |
1133 DrawSpriteRotatedF(sprPlane, x, y, 1, Gear^.Tag, aangle - 90) |
1026 end; |
1134 end; |
1027 gtBall: DrawSpriteRotatedF(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle); |
1135 gtBall: DrawSpriteRotatedF(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle); |
1061 DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle) |
1169 DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle) |
1062 else if Gear^.Health <> 0 then |
1170 else if Gear^.Health <> 0 then |
1063 DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle) |
1171 DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle) |
1064 else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
1172 else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
1065 end; |
1173 end; |
|
1174 gtAirMine: if Gear^.State and gstTmpFlag = 0 then // mine is inactive |
|
1175 begin |
|
1176 Tint(150,150,150,255); |
|
1177 DrawSprite(sprAirMine, x-16, y-16, 15); |
|
1178 untint |
|
1179 end |
|
1180 else if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then // mine is chasing a hog |
|
1181 DrawSprite(sprAirMine, x-16, y-16, (RealTicks div 25) mod 16) |
|
1182 else if Gear^.State and gstChooseTarget <> 0 then // mine is seeking for hogs |
|
1183 DrawSprite(sprAirMine, x-16, y-16, (RealTicks div 125) mod 16) |
|
1184 else |
|
1185 DrawSprite(sprAirMine, x-16, y-16, 4); // mine is active but not seeking |
1066 |
1186 |
1067 gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
1187 gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
1068 DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle) |
1188 DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle) |
1069 else if Gear^.Health <> 0 then |
1189 else if Gear^.Health <> 0 then |
1070 DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle) |
1190 DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle) |
1139 gtParachute: begin |
1259 gtParachute: begin |
1140 DrawSprite(sprParachute, x - 24, y - 48, 0); |
1260 DrawSprite(sprParachute, x - 24, y - 48, 0); |
1141 DrawAltWeapon(Gear, x + 1, y - 3) |
1261 DrawAltWeapon(Gear, x + 1, y - 3) |
1142 end; |
1262 end; |
1143 gtAirAttack: begin |
1263 gtAirAttack: begin |
1144 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF); |
1264 Tint(Gear^.Tint); |
1145 DrawSpriteRotatedF(sprAirplane, x, y, 0, Gear^.Tag, 0); |
1265 DrawSpriteRotatedF(sprAirplane, x, y, 0, Gear^.Tag, 0); |
1146 untint; |
1266 untint; |
1147 DrawSpriteRotatedF(sprAirplane, x, y, 1, Gear^.Tag, 0); |
1267 DrawSpriteRotatedF(sprAirplane, x, y, 1, Gear^.Tag, 0); |
1148 end; |
1268 end; |
1149 gtAirBomb: DrawSpriteRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1269 gtAirBomb: DrawSpriteRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1150 gtTeleport: begin |
1270 gtTeleport: begin |
1151 HHGear:= Gear^.Hedgehog^.Gear; |
1271 HHGear:= Gear^.Hedgehog^.Gear; |
1152 if not Gear^.Hedgehog^.Unplaced then |
1272 if HHGear <> nil then |
1153 DrawSpriteRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); |
1273 begin |
1154 DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
1274 if ((Gear^.State and gstAnimation) <> 0) then |
|
1275 DrawSpriteRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); |
|
1276 DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0) |
|
1277 end |
1155 end; |
1278 end; |
1156 gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12); |
1279 gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12); |
1157 gtTarget: begin |
1280 gtTarget: begin |
1158 Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000)); |
1281 Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000)); |
1159 DrawSprite(sprTarget, x - 16, y - 16, 0); |
1282 DrawSprite(sprTarget, x - 16, y - 16, 0); |
1215 end; |
1338 end; |
1216 DrawTextureF(SpritesData[sprPiano].Texture, 1, x, y, 0, 1, 128, 128); |
1339 DrawTextureF(SpritesData[sprPiano].Texture, 1, x, y, 0, 1, 128, 128); |
1217 end; |
1340 end; |
1218 gtPoisonCloud: begin |
1341 gtPoisonCloud: begin |
1219 if Gear^.Timer < 1020 then |
1342 if Gear^.Timer < 1020 then |
1220 Tint($C0, $C0, $00, Gear^.Timer div 8) |
1343 Tint(Gear^.Tint and $FFFFFF00 or Gear^.Timer div 8) |
1221 else if Gear^.Timer > 3980 then |
1344 else if Gear^.Timer > 3980 then |
1222 Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8) |
1345 Tint(Gear^.Tint and $FFFFFF00 or (5000 - Gear^.Timer) div 8) |
1223 else |
1346 else |
1224 Tint($C0, $C0, $00, $C0); |
1347 Tint(Gear^.Tint); |
1225 DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360); |
1348 DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 4 + Gear^.UID * 100) mod 360); |
1226 untint |
1349 untint |
1227 end; |
1350 end; |
1228 gtResurrector: begin |
1351 gtResurrector: begin |
1229 DrawSpriteRotated(sprCross, x, y, 0, 0); |
1352 DrawSpriteRotated(sprCross, x, y, 0, 0); |
1230 Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000)))); |
1353 Tint(Gear^.Tint and $FFFFFF00 or max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000)))); |
1231 DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5); |
1354 DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5); |
1232 untint; |
1355 untint; |
1233 end; |
1356 end; |
1234 gtNapalmBomb: DrawSpriteRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1357 gtNapalmBomb: DrawSpriteRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1235 gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0 then |
1358 gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0 then |
1236 begin |
1359 begin |
1237 Tint((ExplosionBorderColor shr RShift) and $FF, |
1360 Tint(Gear^.Tint); |
1238 (ExplosionBorderColor shr GShift) and $FF, |
|
1239 (ExplosionBorderColor shr BShift) and $FF, |
|
1240 $FF); |
|
1241 // Needs a nicer white texture to tint |
1361 // Needs a nicer white texture to tint |
1242 DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle); |
1362 DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle); |
1243 //DrawSpriteRotated(sprSnowDust, x, y, 0, Gear^.DirAngle); |
1363 //DrawSpriteRotated(sprSnowDust, x, y, 0, Gear^.DirAngle); |
1244 //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1); |
1364 //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1); |
1245 untint; |
1365 untint; |
1246 end |
1366 end |
1247 else //if not isInLag then |
1367 else //if not isInLag then |
1248 begin |
1368 begin |
1249 if isInLag and (Gear^.FlightTime < 256) then |
1369 if isInLag and (Gear^.FlightTime < 256) then |
1250 inc(Gear^.FlightTime, 8) |
1370 inc(Gear^.FlightTime, 8) |
1251 else if not isInLag and (Gear^.FlightTime > 0) then |
1371 else if (not isInLag) and (Gear^.FlightTime > 0) then |
1252 dec(Gear^.FlightTime, 8); |
1372 dec(Gear^.FlightTime, 8); |
1253 if Gear^.FlightTime > 0 then |
1373 if Gear^.FlightTime > 0 then |
1254 Tint($FF, $FF, $FF, $FF-min(255,Gear^.FlightTime)); |
1374 Tint($FF, $FF, $FF, $FF-min(255,Gear^.FlightTime)); |
1255 if vobVelocity = 0 then |
1375 if vobVelocity = 0 then |
1256 DrawSprite(sprFlake, x, y, Gear^.Timer) |
1376 DrawSprite(sprFlake, x, y, Gear^.Timer) |
1266 begin |
1386 begin |
1267 if Gear^.Pos = 2 then |
1387 if Gear^.Pos = 2 then |
1268 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF) |
1388 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF) |
1269 else |
1389 else |
1270 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); |
1390 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); |
1271 DrawSprite(sprTardis, x-24, y-63,0); |
1391 DrawSprite(sprTardis, x-25, y-64,0); |
1272 if Gear^.Pos = 2 then |
1392 if Gear^.Pos = 2 then |
1273 untint |
1393 untint |
1274 else |
1394 else |
1275 Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); |
1395 Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); |
1276 DrawSprite(sprTardis, x-24, y-63,1); |
1396 DrawSprite(sprTardis, x-25, y-64,1); |
1277 if Gear^.Pos <> 2 then |
1397 if Gear^.Pos <> 2 then |
1278 untint |
1398 untint |
1279 (* |
1399 (* |
1280 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250)))); |
1400 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250)))); |
1281 DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25); |
1401 DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25); |