22 |
22 |
23 interface |
23 interface |
24 uses uTypes, uConsts, GLunit, uFloat, SDLh; |
24 uses uTypes, uConsts, GLunit, uFloat, SDLh; |
25 |
25 |
26 type |
26 type |
27 Tar = record |
27 Tar = record |
28 X, Y: hwFloat; |
28 X, Y: hwFloat; |
29 dLen: hwFloat; |
29 dLen: hwFloat; |
30 b : boolean; |
30 b : boolean; |
31 end; |
31 end; |
32 TRopePoints = record |
32 TRopePoints = record |
33 Count : Longword; |
33 Count : Longword; |
34 HookAngle : GLfloat; |
34 HookAngle : GLfloat; |
35 ar : array[0..MAXROPEPOINTS] of Tar; |
35 ar : array[0..MAXROPEPOINTS] of Tar; |
36 rounded : array[0..MAXROPEPOINTS + 2] of TVertex2f; |
36 rounded : array[0..MAXROPEPOINTS + 2] of TVertex2f; |
37 end; |
37 end; |
38 procedure RenderGear(Gear: PGear; x, y: LongInt); |
38 procedure RenderGear(Gear: PGear; x, y: LongInt); |
39 |
39 |
40 var RopePoints: TRopePoints; |
40 var RopePoints: TRopePoints; |
41 |
41 |
42 implementation |
42 implementation |
43 uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGears; |
43 uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGears; |
|
44 |
|
45 const |
|
46 // hog tag mask |
|
47 htNone = $00; |
|
48 htTeamName = $01; |
|
49 htName = $02; |
|
50 htHealth = $04; |
|
51 htTransparent = $08; |
44 |
52 |
45 procedure DrawRopeLinesRQ(Gear: PGear); |
53 procedure DrawRopeLinesRQ(Gear: PGear); |
46 begin |
54 begin |
47 with RopePoints do |
55 with RopePoints do |
48 begin |
56 begin |
342 end; |
350 end; |
343 end; |
351 end; |
344 // draw crosshair |
352 // draw crosshair |
345 CrosshairX := Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle)); |
353 CrosshairX := Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle)); |
346 CrosshairY := Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle)); |
354 CrosshairY := Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle)); |
347 |
355 |
348 |
356 |
349 DrawTextureRotated(HH^.Team^.CrosshairTex, |
357 DrawTextureRotated(HH^.Team^.CrosshairTex, |
350 12, 12, CrosshairX + WorldDx, CrosshairY + WorldDy, 0, |
358 12, 12, CrosshairX + WorldDx, CrosshairY + WorldDy, 0, |
351 sign * (Gear^.Angle * 180.0) / cMaxAngle); |
359 sign * (Gear^.Angle * 180.0) / cMaxAngle); |
352 end; |
360 end; |
353 hx:= ox + 8 * sign; |
361 hx:= ox + 8 * sign; |
618 amDrill: DrawSpriteRotated(sprHandDrill, hx, hy, sign, aangle); |
626 amDrill: DrawSpriteRotated(sprHandDrill, hx, hy, sign, aangle); |
619 amRope: DrawSpriteRotated(sprHandRope, hx, hy, sign, aangle); |
627 amRope: DrawSpriteRotated(sprHandRope, hx, hy, sign, aangle); |
620 amShotgun: DrawSpriteRotated(sprHandShotgun, hx, hy, sign, aangle); |
628 amShotgun: DrawSpriteRotated(sprHandShotgun, hx, hy, sign, aangle); |
621 amDEagle: DrawSpriteRotated(sprHandDEagle, hx, hy, sign, aangle); |
629 amDEagle: DrawSpriteRotated(sprHandDEagle, hx, hy, sign, aangle); |
622 amSineGun: DrawSpriteRotatedF(sprHandSinegun, hx, hy, 73 + (sign * LongInt(RealTicks div 73)) mod 8, sign, aangle); |
630 amSineGun: DrawSpriteRotatedF(sprHandSinegun, hx, hy, 73 + (sign * LongInt(RealTicks div 73)) mod 8, sign, aangle); |
623 |
631 |
624 amPortalGun: |
632 amPortalGun: |
625 if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer? |
633 if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer? |
626 DrawSpriteRotatedF(sprPortalGun, hx, hy, 0, sign, aangle) |
634 DrawSpriteRotatedF(sprPortalGun, hx, hy, 0, sign, aangle) |
627 else |
635 else |
628 DrawSpriteRotatedF(sprPortalGun, hx, hy, 1+CurWeapon^.Pos, sign, aangle); |
636 DrawSpriteRotatedF(sprPortalGun, hx, hy, 1+CurWeapon^.Pos, sign, aangle); |
629 |
637 |
630 amSniperRifle: DrawSpriteRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle); |
638 amSniperRifle: DrawSpriteRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle); |
631 amBlowTorch: DrawSpriteRotated(sprHandBlowTorch, hx, hy, sign, aangle); |
639 amBlowTorch: DrawSpriteRotated(sprHandBlowTorch, hx, hy, sign, aangle); |
632 amCake: DrawSpriteRotated(sprHandCake, hx, hy, sign, aangle); |
640 amCake: DrawSpriteRotated(sprHandCake, hx, hy, sign, aangle); |
633 amGrenade: DrawSpriteRotated(sprHandGrenade, hx, hy, sign, aangle); |
641 amGrenade: DrawSpriteRotated(sprHandGrenade, hx, hy, sign, aangle); |
634 amWatermelon: DrawSpriteRotated(sprHandMelon, hx, hy, sign, aangle); |
642 amWatermelon: DrawSpriteRotated(sprHandMelon, hx, hy, sign, aangle); |
640 amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle); |
648 amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle); |
641 amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle); |
649 amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle); |
642 amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle); |
650 amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle); |
643 amSeduction: begin |
651 amSeduction: begin |
644 DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle); |
652 DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle); |
645 DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); |
653 DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); |
646 //Tint($FF, $0, $0, $AA); |
654 //Tint($FF, $0, $0, $AA); |
647 //DrawTexture(ox - 240, oy - 240, SpritesData[sprVampiric].Texture, 10); |
655 //DrawTexture(ox - 240, oy - 240, SpritesData[sprVampiric].Texture, 10); |
648 //Tint($FF, $FF, $FF, $FF); |
656 //Tint($FF, $FF, $FF, $FF); |
649 end; |
657 end; |
650 amVampiric: DrawSpriteRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
658 amVampiric: DrawSpriteRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
933 startX, endX, startY, endY: LongInt; |
941 startX, endX, startY, endY: LongInt; |
934 begin |
942 begin |
935 if Gear^.Target.X <> NoPointX then |
943 if Gear^.Target.X <> NoPointX then |
936 if Gear^.AmmoType = amBee then |
944 if Gear^.AmmoType = amBee then |
937 DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
945 DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
938 else if Gear^.AmmoType = amIceGun then |
946 else if Gear^.AmmoType = amIceGun then |
939 //DrawSprite(sprSnowDust, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8) |
947 //DrawSprite(sprSnowDust, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8) |
940 //DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360) |
948 //DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360) |
941 DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1/(1+(RealTicks shr 8) mod 5), 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360) |
949 DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1/(1+(RealTicks shr 8) mod 5), 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360) |
942 else |
950 else |
943 DrawSpriteRotatedF(sprTargetP, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); |
951 DrawSpriteRotatedF(sprTargetP, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); |
944 |
952 |
945 case Gear^.Kind of |
953 case Gear^.Kind of |
946 gtGrenade: DrawSpriteRotated(sprBomb, x, y, 0, Gear^.DirAngle); |
954 gtGrenade: DrawSpriteRotated(sprBomb, x, y, 0, Gear^.DirAngle); |
947 gtSnowball: DrawSpriteRotated(sprSnowball, x, y, 0, Gear^.DirAngle); |
955 gtSnowball: DrawSpriteRotated(sprSnowball, x, y, 0, Gear^.DirAngle); |
948 gtGasBomb: DrawSpriteRotated(sprCheese, x, y, 0, Gear^.DirAngle); |
956 gtGasBomb: DrawSpriteRotated(sprCheese, x, y, 0, Gear^.DirAngle); |
949 |
957 |
950 gtMolotov: if (Gear^.State and gstDrowning) = 0 then |
958 gtMolotov: if (Gear^.State and gstDrowning) = 0 then |
951 DrawSpriteRotatedF(sprMolotov, x, y, (RealTicks div 125) mod 8, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX)) |
959 DrawSpriteRotatedF(sprMolotov, x, y, (RealTicks div 125) mod 8, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX)) |
952 else DrawSprite(sprMolotov, x, y, 8); |
960 else DrawSprite(sprMolotov, x, y, 8); |
953 |
961 |
954 gtRCPlane: begin |
962 gtRCPlane: begin |
988 end |
996 end |
989 end; |
997 end; |
990 gtBee: DrawSpriteRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
998 gtBee: DrawSpriteRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
991 gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0); |
999 gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0); |
992 gtRope: DrawRope(Gear); |
1000 gtRope: DrawRope(Gear); |
993 |
1001 |
994 gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
1002 gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
995 DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle) |
1003 DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle) |
996 else if Gear^.Health <> 0 then |
1004 else if Gear^.Health <> 0 then |
997 DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle) |
1005 DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle) |
998 else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
1006 else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
999 |
1007 |
1000 gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
1008 gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
1001 DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle) |
1009 DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle) |
1002 else if Gear^.Health <> 0 then |
1010 else if Gear^.Health <> 0 then |
1003 DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle) |
1011 DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle) |
1004 else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
1012 else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle); |
1005 gtKnife: DrawSpriteRotatedF(sprKnife, x, y, 0, hwSign(Gear^.dX), Gear^.DirAngle); |
1013 gtKnife: DrawSpriteRotatedF(sprKnife, x, y, 0, hwSign(Gear^.dX), Gear^.DirAngle); |
1006 |
1014 |
1007 gtCase: begin |
1015 gtCase: begin |
1008 if Gear^.Timer > 1000 then |
1016 if Gear^.Timer > 1000 then |
1009 begin |
1017 begin |
1010 if ((Gear^.Pos and posCaseAmmo) <> 0) then |
1018 if ((Gear^.Pos and posCaseAmmo) <> 0) then |
1011 begin |
1019 begin |
1085 DrawSpriteRotatedF(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
1093 DrawSpriteRotatedF(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
1086 else |
1094 else |
1087 DrawSpriteRotatedF(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90); |
1095 DrawSpriteRotatedF(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90); |
1088 gtSeduction: if Gear^.Pos >= 14 then |
1096 gtSeduction: if Gear^.Pos >= 14 then |
1089 DrawSprite(sprSeduction, x - 16, y - 16, 0); |
1097 DrawSprite(sprSeduction, x - 16, y - 16, 0); |
1090 |
1098 |
1091 gtWatermelon: DrawSpriteRotatedF(sprWatermelon, x, y, 0, 0, Gear^.DirAngle); |
1099 gtWatermelon: DrawSpriteRotatedF(sprWatermelon, x, y, 0, 0, Gear^.DirAngle); |
1092 gtMelonPiece: DrawSpriteRotatedF(sprWatermelon, x, y, 1, 0, Gear^.DirAngle); |
1100 gtMelonPiece: DrawSpriteRotatedF(sprWatermelon, x, y, 1, 0, Gear^.DirAngle); |
1093 gtHellishBomb: DrawSpriteRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle); |
1101 gtHellishBomb: DrawSpriteRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle); |
1094 gtBirdy: begin |
1102 gtBirdy: begin |
1095 if Gear^.State and gstAnimation = gstAnimation then |
1103 if Gear^.State and gstAnimation = gstAnimation then |
1153 Tint($FF, $FF, $FF, $FF); |
1161 Tint($FF, $FF, $FF, $FF); |
1154 end; |
1162 end; |
1155 gtNapalmBomb: DrawSpriteRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1163 gtNapalmBomb: DrawSpriteRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1156 gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0 then |
1164 gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0 then |
1157 begin |
1165 begin |
1158 Tint((ExplosionBorderColor shr RShift) and $FF, |
1166 Tint((ExplosionBorderColor shr RShift) and $FF, |
1159 (ExplosionBorderColor shr GShift) and $FF, |
1167 (ExplosionBorderColor shr GShift) and $FF, |
1160 (ExplosionBorderColor shr BShift) and $FF, |
1168 (ExplosionBorderColor shr BShift) and $FF, |
1161 $FF); |
1169 $FF); |
1162 // Needs a nicer white texture to tint |
1170 // Needs a nicer white texture to tint |
1163 DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle); |
1171 DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle); |
1164 //DrawSpriteRotated(sprSnowDust, x, y, 0, Gear^.DirAngle); |
1172 //DrawSpriteRotated(sprSnowDust, x, y, 0, Gear^.DirAngle); |
1165 //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1); |
1173 //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1); |
1180 //DrawSprite(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer) |
1188 //DrawSprite(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer) |
1181 //DrawSpriteRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle); |
1189 //DrawSpriteRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle); |
1182 if Gear^.FlightTime > 0 then |
1190 if Gear^.FlightTime > 0 then |
1183 Tint($FF, $FF, $FF, $FF); |
1191 Tint($FF, $FF, $FF, $FF); |
1184 end; |
1192 end; |
1185 gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0); |
1193 //gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0); |
1186 gtTardis: if Gear^.Pos <> 4 then |
1194 gtTardis: if Gear^.Pos <> 4 then |
1187 begin |
1195 begin |
1188 if Gear^.Pos = 2 then |
1196 if Gear^.Pos = 2 then |
1189 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF) |
1197 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF) |
1190 else |
1198 else |
1191 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); |
1199 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); |
1192 DrawSprite(sprTardis, x-24, y-63,0); |
1200 DrawSprite(sprTardis, x-24, y-63,0); |
1193 if Gear^.Pos = 2 then |
1201 if Gear^.Pos = 2 then |
1194 Tint($FF, $FF, $FF, $FF) |
1202 Tint($FF, $FF, $FF, $FF) |
1195 else |
1203 else |