935 DrawTexture(round(sx + 16), round(sy + 16), ropeIconTex); |
934 DrawTexture(round(sx + 16), round(sy + 16), ropeIconTex); |
936 DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, round(sx + 30), round(sy + 30), ord(Ammo^[CurSlot, CurAmmo].AmmoType) - 1, 1, 32, 32); |
935 DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, round(sx + 30), round(sy + 30), ord(Ammo^[CurSlot, CurAmmo].AmmoType) - 1, 1, 32, 32); |
937 end; |
936 end; |
938 end; |
937 end; |
939 |
938 |
940 procedure DrawHH(Gear: PGear); |
|
941 var i, t: LongInt; |
|
942 amt: TAmmoType; |
|
943 hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
|
944 lx, ly, dx, dy, ax, ay, aAngle, dAngle, hAngle: real; // laser, change |
|
945 defaultPos, HatVisible: boolean; |
|
946 VertexBuffer: array [0..1] of TVertex2f; |
|
947 HH: PHedgehog; |
|
948 begin |
|
949 HH:= PHedgehog(Gear^.Hedgehog); |
|
950 if HH^.Unplaced then exit; |
|
951 m:= 1; |
|
952 if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1; |
|
953 if (Gear^.State and gstHHDeath) <> 0 then |
|
954 begin |
|
955 DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos); |
|
956 exit |
|
957 end |
|
958 else if (Gear^.State and gstHHGone) <> 0 then |
|
959 begin |
|
960 DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(Gear^.dX), 0); |
|
961 exit |
|
962 end; |
|
963 |
|
964 defaultPos:= true; |
|
965 HatVisible:= false; |
|
966 |
|
967 sx:= hwRound(Gear^.X) + 1 + WorldDx; |
|
968 sy:= hwRound(Gear^.Y) - 3 + WorldDy; |
|
969 |
|
970 if HH^.Effects[hePoisoned] then |
|
971 begin |
|
972 Tint($4040FF00); |
|
973 DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360); |
|
974 Tint($FFFFFFFF) |
|
975 end; |
|
976 |
|
977 if ((Gear^.State and gstWinner) <> 0) and |
|
978 ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then |
|
979 begin |
|
980 DrawHedgehog(sx, sy, |
|
981 hwSign(Gear^.dX), |
|
982 2, |
|
983 0, |
|
984 0); |
|
985 defaultPos:= false |
|
986 end; |
|
987 if (Gear^.State and gstDrowning) <> 0 then |
|
988 begin |
|
989 DrawHedgehog(sx, sy, |
|
990 hwSign(Gear^.dX), |
|
991 1, |
|
992 7, |
|
993 0); |
|
994 defaultPos:= false |
|
995 end else |
|
996 if (Gear^.State and gstLoser) <> 0 then |
|
997 begin |
|
998 DrawHedgehog(sx, sy, |
|
999 hwSign(Gear^.dX), |
|
1000 2, |
|
1001 3, |
|
1002 0); |
|
1003 defaultPos:= false |
|
1004 end else |
|
1005 |
|
1006 if (Gear^.State and gstHHDriven) <> 0 then |
|
1007 begin |
|
1008 if ((Gear^.State and gstHHThinking) = 0) and |
|
1009 (ShowCrosshair or ((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtRope))) and |
|
1010 ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
|
1011 begin |
|
1012 (* These calculations are a little complex for a few reasons: |
|
1013 1: I need to draw the laser from weapon origin to nearest land |
|
1014 2: I need to start the beam outside the hedgie for attractiveness. |
|
1015 3: I need to extend the beam beyond land. |
|
1016 This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. |
|
1017 *) |
|
1018 dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle); |
|
1019 dy:= - Cos(Gear^.Angle * pi / cMaxAngle); |
|
1020 if cLaserSighting then |
|
1021 begin |
|
1022 lx:= hwRound(Gear^.X); |
|
1023 ly:= hwRound(Gear^.Y); |
|
1024 lx:= lx + dx * 16; |
|
1025 ly:= ly + dy * 16; |
|
1026 |
|
1027 ax:= dx * 4; |
|
1028 ay:= dy * 4; |
|
1029 |
|
1030 tx:= round(lx); |
|
1031 ty:= round(ly); |
|
1032 hx:= tx; |
|
1033 hy:= ty; |
|
1034 while ((ty and LAND_HEIGHT_MASK) = 0) and |
|
1035 ((tx and LAND_WIDTH_MASK) = 0) and |
|
1036 (Land[ty, tx] = 0) do |
|
1037 begin |
|
1038 lx:= lx + ax; |
|
1039 ly:= ly + ay; |
|
1040 tx:= round(lx); |
|
1041 ty:= round(ly) |
|
1042 end; |
|
1043 // reached edge of land. assume infinite beam. Extend it way out past camera |
|
1044 if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then |
|
1045 begin |
|
1046 tx:= round(lx + ax * (LAND_WIDTH div 4)); |
|
1047 ty:= round(ly + ay * (LAND_WIDTH div 4)); |
|
1048 end; |
|
1049 |
|
1050 //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then |
|
1051 begin |
|
1052 glDisable(GL_TEXTURE_2D); |
|
1053 glEnable(GL_LINE_SMOOTH); |
|
1054 |
|
1055 glLineWidth(1.0); |
|
1056 |
|
1057 Tint($C0FF0000); |
|
1058 VertexBuffer[0].X:= hx + WorldDx; |
|
1059 VertexBuffer[0].Y:= hy + WorldDy; |
|
1060 VertexBuffer[1].X:= tx + WorldDx; |
|
1061 VertexBuffer[1].Y:= ty + WorldDy; |
|
1062 |
|
1063 glEnableClientState(GL_VERTEX_ARRAY); |
|
1064 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
|
1065 glDrawArrays(GL_LINES, 0, Length(VertexBuffer)); |
|
1066 Tint($FFFFFFFF); |
|
1067 glEnable(GL_TEXTURE_2D); |
|
1068 glDisable(GL_LINE_SMOOTH); |
|
1069 end; |
|
1070 end; |
|
1071 // draw crosshair |
|
1072 cx:= Round(hwRound(Gear^.X) + dx * 80); |
|
1073 cy:= Round(hwRound(Gear^.Y) + dy * 80); |
|
1074 DrawRotatedTex(HH^.Team^.CrosshairTex, |
|
1075 12, 12, cx + WorldDx, cy + WorldDy, 0, |
|
1076 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle); |
|
1077 end; |
|
1078 hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx; |
|
1079 hy:= hwRound(Gear^.Y) - 2 + WorldDy; |
|
1080 aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
|
1081 |
|
1082 if CurAmmoGear <> nil then |
|
1083 begin |
|
1084 case CurAmmoGear^.Kind of |
|
1085 gtShotgunShot: begin |
|
1086 if (CurAmmoGear^.State and gstAnimation <> 0) then |
|
1087 DrawRotated(sprShotgun, hx, hy, hwSign(Gear^.dX), aangle) |
|
1088 else |
|
1089 DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
1090 end; |
|
1091 gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
|
1092 gtSniperRifleShot: begin |
|
1093 if (CurAmmoGear^.State and gstAnimation <> 0) then |
|
1094 DrawRotatedF(sprSniperRifle, hx, hy, 1, hwSign(Gear^.dX), aangle) |
|
1095 else |
|
1096 DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle) |
|
1097 end; |
|
1098 gtBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
1099 gtRCPlane: begin |
|
1100 DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); |
|
1101 defaultPos:= false |
|
1102 end; |
|
1103 gtRope: begin |
|
1104 if Gear^.X < CurAmmoGear^.X then |
|
1105 begin |
|
1106 dAngle:= 0; |
|
1107 hAngle:= 180; |
|
1108 i:= 1 |
|
1109 end else |
|
1110 begin |
|
1111 dAngle:= 180; |
|
1112 hAngle:= 0; |
|
1113 i:= -1 |
|
1114 end; |
|
1115 sx:= hwRound(Gear^.X) + WorldDx; |
|
1116 sy:= hwRound(Gear^.Y) + WorldDy; |
|
1117 if ((Gear^.State and gstWinner) = 0) then |
|
1118 begin |
|
1119 DrawHedgehog(sx, sy, |
|
1120 i, |
|
1121 1, |
|
1122 0, |
|
1123 DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); |
|
1124 with HH^ do |
|
1125 if (HatTex <> nil) then |
|
1126 DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, sx, sy, 0, i, 32, 32, |
|
1127 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
|
1128 end; |
|
1129 DrawAltWeapon(Gear, sx, sy); |
|
1130 defaultPos:= false |
|
1131 end; |
|
1132 gtBlowTorch: begin |
|
1133 DrawRotated(sprBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
|
1134 DrawHedgehog(sx, sy, |
|
1135 hwSign(Gear^.dX), |
|
1136 3, |
|
1137 HH^.visStepPos div 2, |
|
1138 0); |
|
1139 with HH^ do |
|
1140 if (HatTex <> nil) then |
|
1141 DrawTextureF(HatTex, |
|
1142 1, |
|
1143 sx, |
|
1144 hwRound(Gear^.Y) - 8 + WorldDy, |
|
1145 0, |
|
1146 hwSign(Gear^.dX), |
|
1147 32, |
|
1148 32); |
|
1149 defaultPos:= false |
|
1150 end; |
|
1151 gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180); |
|
1152 gtFirePunch: begin |
|
1153 DrawHedgehog(sx, sy, |
|
1154 hwSign(Gear^.dX), |
|
1155 1, |
|
1156 4, |
|
1157 0); |
|
1158 defaultPos:= false |
|
1159 end; |
|
1160 gtPickHammer: begin |
|
1161 defaultPos:= false; |
|
1162 dec(sy,20); |
|
1163 end; |
|
1164 gtTeleport: defaultPos:= false; |
|
1165 gtWhip: begin |
|
1166 DrawRotatedF(sprWhip, |
|
1167 sx, |
|
1168 sy, |
|
1169 1, |
|
1170 hwSign(Gear^.dX), |
|
1171 0); |
|
1172 defaultPos:= false |
|
1173 end; |
|
1174 gtKamikaze: begin |
|
1175 if CurAmmoGear^.Pos = 0 then |
|
1176 DrawHedgehog(sx, sy, |
|
1177 hwSign(Gear^.dX), |
|
1178 1, |
|
1179 6, |
|
1180 0) |
|
1181 else |
|
1182 DrawRotatedF(sprKamikaze, |
|
1183 hwRound(Gear^.X) + WorldDx, |
|
1184 hwRound(Gear^.Y) + WorldDy, |
|
1185 CurAmmoGear^.Pos - 1, |
|
1186 hwSign(Gear^.dX), |
|
1187 aangle); |
|
1188 defaultPos:= false |
|
1189 end; |
|
1190 gtSeduction: begin |
|
1191 if CurAmmoGear^.Pos >= 6 then |
|
1192 DrawHedgehog(sx, sy, |
|
1193 hwSign(Gear^.dX), |
|
1194 2, |
|
1195 2, |
|
1196 0) |
|
1197 else |
|
1198 begin |
|
1199 DrawRotatedF(sprDress, |
|
1200 hwRound(Gear^.X) + WorldDx, |
|
1201 hwRound(Gear^.Y) + WorldDy, |
|
1202 CurAmmoGear^.Pos, |
|
1203 hwSign(Gear^.dX), |
|
1204 0); |
|
1205 DrawSprite(sprCensored, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 20 + WorldDy, 0) |
|
1206 end; |
|
1207 defaultPos:= false |
|
1208 end; |
|
1209 end; |
|
1210 |
|
1211 case CurAmmoGear^.Kind of |
|
1212 gtShotgunShot, |
|
1213 gtDEagleShot, |
|
1214 gtSniperRifleShot, |
|
1215 gtShover: begin |
|
1216 DrawHedgehog(sx, sy, |
|
1217 hwSign(Gear^.dX), |
|
1218 0, |
|
1219 4, |
|
1220 0); |
|
1221 defaultPos:= false; |
|
1222 HatVisible:= true |
|
1223 end |
|
1224 end |
|
1225 end else |
|
1226 |
|
1227 if ((Gear^.State and gstHHJumping) <> 0) then |
|
1228 begin |
|
1229 DrawHedgehog(sx, sy, |
|
1230 hwSign(Gear^.dX)*m, |
|
1231 1, |
|
1232 1, |
|
1233 0); |
|
1234 HatVisible:= true; |
|
1235 defaultPos:= false |
|
1236 end else |
|
1237 |
|
1238 if (Gear^.Message and (gm_Left or gm_Right) <> 0) and (not isCursorVisible) then |
|
1239 begin |
|
1240 DrawHedgehog(sx, sy, |
|
1241 hwSign(Gear^.dX), |
|
1242 0, |
|
1243 HH^.visStepPos div 2, |
|
1244 0); |
|
1245 defaultPos:= false; |
|
1246 HatVisible:= true |
|
1247 end |
|
1248 else |
|
1249 |
|
1250 if ((Gear^.State and gstAnimation) <> 0) then |
|
1251 begin |
|
1252 if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then |
|
1253 begin |
|
1254 Gear^.State:= Gear^.State and not gstAnimation; |
|
1255 end |
|
1256 else |
|
1257 begin |
|
1258 DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
|
1259 sx, |
|
1260 sy, |
|
1261 Gear^.Pos, |
|
1262 hwSign(Gear^.dX), |
|
1263 0.0); |
|
1264 defaultPos:= false |
|
1265 end |
|
1266 end |
|
1267 else |
|
1268 if ((Gear^.State and gstAttacked) = 0) then |
|
1269 begin |
|
1270 if HH^.Timer > 0 then |
|
1271 begin |
|
1272 // There must be a tidier way to do this. Anyone? |
|
1273 if aangle <= 90 then aangle:= aangle+360; |
|
1274 if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*HH^.Timer/10) |
|
1275 else aangle:= aangle+((240-aangle)*HH^.Timer/10); |
|
1276 dec(HH^.Timer) |
|
1277 end; |
|
1278 amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
|
1279 case amt of |
|
1280 amBazooka: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle); |
|
1281 amMortar: DrawRotated(sprHandMortar, hx, hy, hwSign(Gear^.dX), aangle); |
|
1282 amMolotov: DrawRotated(sprHandMolotov, hx, hy, hwSign(Gear^.dX), aangle); |
|
1283 amBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
1284 amDrill: DrawRotated(sprHandDrill, hx, hy, hwSign(Gear^.dX), aangle); |
|
1285 amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle); |
|
1286 amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
1287 amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
|
1288 amSineGun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
1289 amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle); |
|
1290 amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
|
1291 amCake: DrawRotated(sprHandCake, hx, hy, hwSign(Gear^.dX), aangle); |
|
1292 amGrenade: DrawRotated(sprHandGrenade, hx, hy, hwSign(Gear^.dX), aangle); |
|
1293 amWatermelon: DrawRotated(sprHandMelon, hx, hy, hwSign(Gear^.dX), aangle); |
|
1294 amSkip: DrawRotated(sprHandSkip, hx, hy, hwSign(Gear^.dX), aangle); |
|
1295 amClusterBomb: DrawRotated(sprHandCluster, hx, hy, hwSign(Gear^.dX), aangle); |
|
1296 amDynamite: DrawRotated(sprHandDynamite, hx, hy, hwSign(Gear^.dX), aangle); |
|
1297 amHellishBomb: DrawRotated(sprHandHellish, hx, hy, hwSign(Gear^.dX), aangle); |
|
1298 amMine: DrawRotated(sprHandMine, hx, hy, hwSign(Gear^.dX), aangle); |
|
1299 amSeduction: DrawRotated(sprHandSeduction, hx, hy, hwSign(Gear^.dX), aangle); |
|
1300 amVampiric: DrawRotated(sprHandVamp, hx, hy, hwSign(Gear^.dX), aangle); |
|
1301 amRCPlane: begin |
|
1302 DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); |
|
1303 defaultPos:= false |
|
1304 end; |
|
1305 amGirder: begin |
|
1306 DrawRotated(sprHandConstruction, hx, hy, hwSign(Gear^.dX), aangle); |
|
1307 DrawSpriteClipped(sprGirder, |
|
1308 sx-256, |
|
1309 sy-256, |
|
1310 LongInt(topY)+WorldDy, |
|
1311 LongInt(rightX)+WorldDx, |
|
1312 cWaterLine+WorldDy, |
|
1313 LongInt(leftX)+WorldDx) |
|
1314 end; |
|
1315 amBee: DrawRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, hwSign(Gear^.dX), aangle); |
|
1316 end; |
|
1317 |
|
1318 case amt of |
|
1319 amAirAttack, |
|
1320 amMineStrike: DrawRotated(sprHandAirAttack, sx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0); |
|
1321 amPickHammer: DrawHedgehog(sx, sy, |
|
1322 hwSign(Gear^.dX), |
|
1323 1, |
|
1324 2, |
|
1325 0); |
|
1326 amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, hwSign(Gear^.dX), 0); |
|
1327 amKamikaze: DrawHedgehog(sx, sy, |
|
1328 hwSign(Gear^.dX), |
|
1329 1, |
|
1330 5, |
|
1331 0); |
|
1332 amWhip: DrawRotatedF(sprWhip, |
|
1333 sx, |
|
1334 sy, |
|
1335 0, |
|
1336 hwSign(Gear^.dX), |
|
1337 0); |
|
1338 else |
|
1339 DrawHedgehog(sx, sy, |
|
1340 hwSign(Gear^.dX), |
|
1341 0, |
|
1342 4, |
|
1343 0); |
|
1344 |
|
1345 HatVisible:= true; |
|
1346 (* with HH^ do |
|
1347 if (HatTex <> nil) |
|
1348 and (HatVisibility > 0) then |
|
1349 DrawTextureF(HatTex, |
|
1350 HatVisibility, |
|
1351 sx, |
|
1352 hwRound(Gear^.Y) - 8 + WorldDy, |
|
1353 0, |
|
1354 hwSign(Gear^.dX), |
|
1355 32, |
|
1356 32); *) |
|
1357 end; |
|
1358 |
|
1359 case amt of |
|
1360 amBaseballBat: DrawRotated(sprHandBaseball, |
|
1361 hwRound(Gear^.X) + 1 - 4 * hwSign(Gear^.dX) + WorldDx, |
|
1362 hwRound(Gear^.Y) + 6 + WorldDy, hwSign(Gear^.dX), aangle); |
|
1363 end; |
|
1364 |
|
1365 defaultPos:= false |
|
1366 end; |
|
1367 |
|
1368 end else // not gstHHDriven |
|
1369 begin |
|
1370 if (Gear^.Damage > 0) |
|
1371 and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
|
1372 begin |
|
1373 DrawHedgehog(sx, sy, |
|
1374 hwSign(Gear^.dX), |
|
1375 2, |
|
1376 1, |
|
1377 Gear^.DirAngle); |
|
1378 defaultPos:= false |
|
1379 end else |
|
1380 |
|
1381 if ((Gear^.State and gstHHJumping) <> 0) then |
|
1382 begin |
|
1383 DrawHedgehog(sx, sy, |
|
1384 hwSign(Gear^.dX)*m, |
|
1385 1, |
|
1386 1, |
|
1387 0); |
|
1388 defaultPos:= false |
|
1389 end; |
|
1390 end; |
|
1391 |
|
1392 with HH^ do |
|
1393 begin |
|
1394 if defaultPos then |
|
1395 begin |
|
1396 DrawRotatedF(sprHHIdle, |
|
1397 sx, |
|
1398 sy, |
|
1399 (RealTicks div 128 + Gear^.Pos) mod 19, |
|
1400 hwSign(Gear^.dX), |
|
1401 0); |
|
1402 HatVisible:= true; |
|
1403 end; |
|
1404 |
|
1405 if HatVisible then |
|
1406 if HatVisibility < 1.0 then |
|
1407 HatVisibility:= HatVisibility + 0.2 |
|
1408 else |
|
1409 else |
|
1410 if HatVisibility > 0.0 then |
|
1411 HatVisibility:= HatVisibility - 0.2; |
|
1412 |
|
1413 if (HatTex <> nil) |
|
1414 and (HatVisibility > 0) then |
|
1415 if DefaultPos then |
|
1416 DrawTextureF(HatTex, |
|
1417 HatVisibility, |
|
1418 sx, |
|
1419 hwRound(Gear^.Y) - 8 + WorldDy, |
|
1420 (RealTicks div 128 + Gear^.Pos) mod 19, |
|
1421 hwSign(Gear^.dX), |
|
1422 32, |
|
1423 32) |
|
1424 else |
|
1425 DrawTextureF(HatTex, |
|
1426 HatVisibility, |
|
1427 sx, |
|
1428 hwRound(Gear^.Y) - 8 + WorldDy, |
|
1429 0, |
|
1430 hwSign(Gear^.dX)*m, |
|
1431 32, |
|
1432 32); |
|
1433 end; |
|
1434 if (Gear^.State and gstHHDriven) <> 0 then |
|
1435 begin |
|
1436 (* if (CurAmmoGear = nil) then |
|
1437 begin |
|
1438 amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
|
1439 case amt of |
|
1440 amJetpack: DrawSprite(sprJetpack, sx-32, sy-32, 0); |
|
1441 end |
|
1442 end; *) |
|
1443 if CurAmmoGear <> nil then |
|
1444 begin |
|
1445 case CurAmmoGear^.Kind of |
|
1446 gtJetpack: begin |
|
1447 DrawSprite(sprJetpack, sx-32, sy-32, 0); |
|
1448 if (CurAmmoGear^.MsgParam and gm_Up) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 1); |
|
1449 if (CurAmmoGear^.MsgParam and gm_Left) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 2); |
|
1450 if (CurAmmoGear^.MsgParam and gm_Right) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 3); |
|
1451 if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex); |
|
1452 DrawAltWeapon(Gear, sx, sy) |
|
1453 end; |
|
1454 end; |
|
1455 end |
|
1456 end; |
|
1457 |
|
1458 with HH^ do |
|
1459 begin |
|
1460 if ((Gear^.State and not gstWinner) = 0) |
|
1461 or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
|
1462 begin |
|
1463 t:= hwRound(Gear^.Y) - cHHRadius - 12 + WorldDy; |
|
1464 if (cTagsMask and htTransparent) <> 0 then |
|
1465 Tint($80FFFFFF); |
|
1466 if ((cTagsMask and htHealth) <> 0) then |
|
1467 begin |
|
1468 dec(t, HealthTagTex^.h + 2); |
|
1469 DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex) |
|
1470 end; |
|
1471 if (cTagsMask and htName) <> 0 then |
|
1472 begin |
|
1473 dec(t, NameTagTex^.h + 2); |
|
1474 DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex) |
|
1475 end; |
|
1476 if (cTagsMask and htTeamName) <> 0 then |
|
1477 begin |
|
1478 dec(t, Team^.NameTagTex^.h + 2); |
|
1479 DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex) |
|
1480 end; |
|
1481 if (cTagsMask and htTransparent) <> 0 then |
|
1482 Tint($FFFFFFFF) |
|
1483 end; |
|
1484 if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
|
1485 begin |
|
1486 if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
|
1487 DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy, |
|
1488 GameTicks div 32 mod 16); |
|
1489 |
|
1490 if (Gear^.State and gstDrowning) = 0 then |
|
1491 if (Gear^.State and gstHHThinking) <> 0 then |
|
1492 DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, (RealTicks shr 9) mod 8) |
|
1493 end |
|
1494 end; |
|
1495 |
|
1496 if HH^.Effects[hePoisoned] then |
|
1497 begin |
|
1498 Tint($8040FF00); |
|
1499 DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360); |
|
1500 end; |
|
1501 |
|
1502 if Gear^.Invulnerable then |
|
1503 begin |
|
1504 Tint($FF, $FF, $FF, max($40, floor($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); |
|
1505 DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
|
1506 end; |
|
1507 if cVampiric and |
|
1508 (CurrentHedgehog^.Gear <> nil) and |
|
1509 (CurrentHedgehog^.Gear = Gear) then |
|
1510 begin |
|
1511 Tint($FF, $FF, $FF, max($40, floor($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
|
1512 DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
|
1513 end; |
|
1514 Tint($FFFFFFFF) |
|
1515 end; |
|
1516 |
|
1517 procedure DrawRopeLinesRQ(Gear: PGear); |
939 procedure DrawRopeLinesRQ(Gear: PGear); |
1518 begin |
940 begin |
1519 with RopePoints do |
941 with RopePoints do |
1520 begin |
942 begin |
1521 rounded[Count].X:= hwRound(Gear^.X); |
943 rounded[Count].X:= hwRound(Gear^.X); |
1645 else |
1067 else |
1646 if Gear^.Elasticity.QWordValue > 0 then |
1068 if Gear^.Elasticity.QWordValue > 0 then |
1647 DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1069 DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1648 end; |
1070 end; |
1649 |
1071 |
1650 procedure DrawGears; |
1072 {$INCLUDE "GearDrawing.inc"} |
1651 var Gear, HHGear: PGear; |
|
1652 i: Longword; |
|
1653 startX, endX, startY, endY: LongInt; |
|
1654 begin |
|
1655 Gear:= GearsList; |
|
1656 while Gear<>nil do |
|
1657 begin |
|
1658 case Gear^.Kind of |
|
1659 gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
1660 gtGasBomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
1661 gtMolotov: DrawRotated(sprMolotov, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
1662 |
|
1663 gtRCPlane: begin |
|
1664 if (Gear^.Tag = -1) then |
|
1665 DrawRotated(sprPlane, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) |
|
1666 else |
|
1667 DrawRotated(sprPlane, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,0,DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
1668 if ((TrainingFlags and tfRCPlane) <> 0) and (TrainingTargetGear <> nil) and ((Gear^.State and gstDrowning) = 0) then |
|
1669 DrawRotatedf(sprFinger, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, GameTicks div 32 mod 16, 0, DxDy2Angle(Gear^.X - TrainingTargetGear^.X, TrainingTargetGear^.Y - Gear^.Y)); |
|
1670 end; |
|
1671 gtBall: DrawRotatedf(sprBalls, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tag,0, Gear^.DirAngle); |
|
1672 |
|
1673 gtDrill: DrawRotated(sprDrill, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
1674 |
|
1675 gtHedgehog: DrawHH(Gear); |
|
1676 |
|
1677 gtAmmo_Grenade: DrawRotated(sprGrenade, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
1678 |
|
1679 gtHealthTag: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex); |
|
1680 |
|
1681 gtGrave: DrawTextureF(PHedgehog(Gear^.Hedgehog)^.Team^.GraveTex, 1, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32); |
|
1682 |
|
1683 gtBee: DrawRotatedF(sprBee, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
1684 |
|
1685 gtPickHammer: DrawSprite(sprPHammer, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 50 + LongInt(((GameTicks shr 5) and 1) * 2) + WorldDy, 0); |
|
1686 gtRope: DrawRope(Gear); |
|
1687 gtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State); |
|
1688 gtExplosion: DrawSprite(sprExplosion50, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 32 + WorldDy, Gear^.State); |
|
1689 gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then |
|
1690 DrawRotated(sprMineOff, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle) |
|
1691 else if Gear^.Health <> 0 then DrawRotated(sprMineOn, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle) |
|
1692 else DrawRotated(sprMineDead, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
1693 gtCase: case Gear^.Pos of |
|
1694 posCaseAmmo : begin |
|
1695 i:= (GameTicks shr 6) mod 64; |
|
1696 if i > 18 then i:= 0; |
|
1697 DrawSprite(sprCase, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); |
|
1698 end; |
|
1699 posCaseHealth: begin |
|
1700 i:= ((GameTicks shr 6) + 38) mod 64; |
|
1701 if i > 13 then i:= 0; |
|
1702 DrawSprite(sprFAid, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); |
|
1703 end; |
|
1704 posCaseUtility: begin |
|
1705 i:= (GameTicks shr 6) mod 70; |
|
1706 if i > 23 then i:= 0; |
|
1707 i:= i mod 12; |
|
1708 DrawSprite(sprUtility, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); |
|
1709 end; |
|
1710 end; |
|
1711 gtExplosives: begin |
|
1712 if ((Gear^.State and gstDrowning) <> 0) then |
|
1713 DrawSprite(sprExplosivesRoll, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, 0) |
|
1714 else if Gear^.State and gstAnimation = 0 then |
|
1715 begin |
|
1716 i:= (GameTicks shr 6 + Gear^.uid*3) mod 64; |
|
1717 if i > 18 then i:= 0; |
|
1718 DrawSprite(sprExplosives, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i) |
|
1719 end |
|
1720 else if Gear^.State and gsttmpFlag = 0 then |
|
1721 DrawRotatedF(sprExplosivesRoll, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) +4 + WorldDy, 0, 0, Gear^.DirAngle) |
|
1722 else |
|
1723 DrawRotatedF(sprExplosivesRoll, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) +4 + WorldDy, 1, 0, Gear^.DirAngle); |
|
1724 end; |
|
1725 gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1); |
|
1726 gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
1727 gtCluster: DrawSprite(sprClusterParticle, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, 0); |
|
1728 gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 128 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16); |
|
1729 gtParachute: begin |
|
1730 DrawSprite(sprParachute, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 48 + WorldDy, 0); |
|
1731 DrawAltWeapon(Gear, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy) |
|
1732 end; |
|
1733 gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, hwRound(Gear^.X) - SpritesData[sprAirplane].Width div 2 + WorldDx, hwRound(Gear^.Y) - SpritesData[sprAirplane].Height div 2 + WorldDy, 0) |
|
1734 else DrawSprite(sprAirplane, hwRound(Gear^.X) - SpritesData[sprAirplane].Width div 2 + WorldDx, hwRound(Gear^.Y) - SpritesData[sprAirplane].Height div 2 + WorldDy, 1); |
|
1735 gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
1736 gtTeleport: begin |
|
1737 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1738 if not PHedgehog(Gear^.Hedgehog)^.Unplaced then DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(Gear^.dX), 0); |
|
1739 DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
1740 end; |
|
1741 gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12); |
|
1742 gtTarget: begin |
|
1743 Tint($FF, $FF, $FF, floor($FF * Gear^.Timer / 1000)); |
|
1744 DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
|
1745 Tint($FFFFFFFF); |
|
1746 end; |
|
1747 gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
1748 gtCake: if Gear^.Pos = 6 then |
|
1749 DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
|
1750 else |
|
1751 DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0); |
|
1752 gtSeduction: if Gear^.Pos >= 14 then DrawSprite(sprSeduction, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
|
1753 gtWatermelon: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 0, Gear^.DirAngle); |
|
1754 gtMelonPiece: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 1, 0, Gear^.DirAngle); |
|
1755 gtHellishBomb: DrawRotated(sprHellishBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
1756 gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State); |
|
1757 gtBirdy: begin |
|
1758 if Gear^.State and gstAnimation = gstAnimation then |
|
1759 begin |
|
1760 if Gear^.State and gstTmpFlag = 0 then // Appearing |
|
1761 begin |
|
1762 endX:= hwRound(Gear^.X); |
|
1763 endY:= hwRound(Gear^.Y); |
|
1764 if Gear^.Tag < 0 then |
|
1765 startX:= max(LAND_WIDTH + 1024, endX + 2048) |
|
1766 else |
|
1767 startX:= max(-LAND_WIDTH - 1024, endX - 2048); |
|
1768 startY:= endY - 256; |
|
1769 DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + trunc((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1)), startY + WorldDy + trunc((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); |
|
1770 end |
|
1771 else // Disappearing |
|
1772 begin |
|
1773 startX:= hwRound(Gear^.X); |
|
1774 startY:= hwRound(Gear^.Y); |
|
1775 if Gear^.Tag > 0 then |
|
1776 endX:= max(LAND_WIDTH + 1024, startX + 2048) |
|
1777 else |
|
1778 endX:= max(-LAND_WIDTH - 1024, startX - 2048); |
|
1779 endY:= startY + 256; |
|
1780 DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + trunc((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + trunc((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); |
|
1781 end; |
|
1782 end |
|
1783 else |
|
1784 DrawTextureF(SpritesData[sprBirdy].Texture, 1, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); |
|
1785 end; |
|
1786 gtBigExplosion: begin |
|
1787 Tint($FF, $FF, $FF, floor($FF * (1 - power(Gear^.Timer / 250, 4)))); |
|
1788 DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle); |
|
1789 Tint($FFFFFFFF); |
|
1790 end; |
|
1791 gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 16, 16, Gear^.DirAngle); |
|
1792 gtPiano: begin |
|
1793 if (Gear^.State and gstDrowning) = 0 then |
|
1794 begin |
|
1795 Tint($10FFFFFF); |
|
1796 for i:= 8 downto 1 do |
|
1797 DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128, 0); |
|
1798 Tint($FFFFFFFF) |
|
1799 end; |
|
1800 DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 128, 128, 0); |
|
1801 end; |
|
1802 end; |
|
1803 if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(hwRound(Gear^.X) + 8 + WorldDx, hwRound(Gear^.Y) + 8 + WorldDy, Gear^.Tex); |
|
1804 Gear:= Gear^.NextGear |
|
1805 end; |
|
1806 end; |
|
1807 |
1073 |
1808 procedure FreeGearsList; |
1074 procedure FreeGearsList; |
1809 var t, tt: PGear; |
1075 var t, tt: PGear; |
1810 begin |
1076 begin |
1811 tt:= GearsList; |
1077 tt:= GearsList; |