1158 shell^.dY := gear^.dY.QWordValue / -17179869184; |
1158 shell^.dY := gear^.dY.QWordValue / -17179869184; |
1159 shell^.Frame := startFrame; |
1159 shell^.Frame := startFrame; |
1160 end; |
1160 end; |
1161 end; |
1161 end; |
1162 |
1162 |
|
1163 function ShotgunLineHitHelp(Gear: PGear; oX, oY, tX, tY: hwFloat): Boolean; |
|
1164 var i: LongInt; |
|
1165 Collisions: PGearArray; |
|
1166 begin |
|
1167 ShotgunLineHitHelp := false; |
|
1168 Collisions := CheckAllGearsLineCollision(Gear, oX, oY, tX, tY); |
|
1169 i := Collisions^.Count; |
|
1170 while i > 0 do |
|
1171 begin |
|
1172 dec(i); |
|
1173 if Collisions^.ar[i]^.Kind in |
|
1174 [gtMine, gtSMine, gtAirMine, gtKnife, gtCase, gtTarget, gtExplosives] then |
|
1175 begin |
|
1176 Gear^.X := Collisions^.ar[i]^.X; |
|
1177 Gear^.Y := Collisions^.ar[i]^.Y; |
|
1178 ShotgunShot(Gear); |
|
1179 Gear^.doStep := @doStepShotIdle; |
|
1180 ShotgunLineHitHelp := true; |
|
1181 exit; |
|
1182 end; |
|
1183 end; |
|
1184 end; |
|
1185 |
1163 procedure doStepShotgunShot(Gear: PGear); |
1186 procedure doStepShotgunShot(Gear: PGear); |
1164 var |
1187 var |
1165 i: LongWord; |
1188 i: LongWord; |
|
1189 oX, oY, tmpX, tmpY: hwFloat; |
1166 begin |
1190 begin |
1167 AllInactive := false; |
1191 AllInactive := false; |
1168 |
1192 |
1169 if ((Gear^.State and gstAnimation) = 0) then |
1193 if ((Gear^.State and gstAnimation) = 0) then |
1170 begin |
1194 begin |
1184 exit |
1208 exit |
1185 end |
1209 end |
1186 else |
1210 else |
1187 inc(Gear^.Timer); |
1211 inc(Gear^.Timer); |
1188 |
1212 |
1189 i := 200; |
1213 i := 100; |
|
1214 oX := Gear^.X; |
|
1215 oY := Gear^.Y; |
1190 repeat |
1216 repeat |
1191 Gear^.X := Gear^.X + Gear^.dX; |
1217 if Gear^.Tag = 0 then |
1192 Gear^.Y := Gear^.Y + Gear^.dY; |
1218 begin |
1193 WorldWrap(Gear); |
1219 Gear^.X := Gear^.X + Gear^.dX; |
|
1220 Gear^.Y := Gear^.Y + Gear^.dY; |
|
1221 end; |
|
1222 |
|
1223 tmpX := Gear^.X; |
|
1224 tmpY := Gear^.Y; |
|
1225 if (Gear^.PortalCounter < 30) and WorldWrap(Gear) then |
|
1226 begin |
|
1227 inc(Gear^.PortalCounter); |
|
1228 if ShotgunLineHitHelp(Gear, oX, oY, tmpX, tmpY) then |
|
1229 exit; |
|
1230 oX := Gear^.X; |
|
1231 oY := Gear^.Y; |
|
1232 end; |
1194 CheckCollision(Gear); |
1233 CheckCollision(Gear); |
1195 if (Gear^.State and gstCollision) <> 0 then |
1234 |
1196 begin |
1235 if ((Gear^.State and gstCollision) <> 0) then |
1197 Gear^.X := Gear^.X + Gear^.dX * 8; |
1236 begin |
1198 Gear^.Y := Gear^.Y + Gear^.dY * 8; |
1237 if Gear^.Tag = 0 then |
1199 ShotgunShot(Gear); |
1238 begin |
1200 Gear^.doStep := @doStepShotIdle; |
1239 //Try to align the shot with the land to give portals a chance to catch it |
1201 exit |
1240 Gear^.X := Gear^.X + Gear^.dX * 2; |
1202 end; |
1241 Gear^.Y := Gear^.Y + Gear^.dY * 2; |
|
1242 Gear^.Tag := 1 |
|
1243 end |
|
1244 else |
|
1245 begin |
|
1246 Gear^.X := Gear^.X + Gear^.dX * 6; |
|
1247 Gear^.Y := Gear^.Y + Gear^.dY * 6; |
|
1248 ShotgunShot(Gear); |
|
1249 Gear^.doStep := @doStepShotIdle; |
|
1250 end; |
|
1251 exit |
|
1252 end |
|
1253 else |
|
1254 Gear^.Tag := 0; |
1203 |
1255 |
1204 CheckGearDrowning(Gear); |
1256 CheckGearDrowning(Gear); |
1205 if (Gear^.State and gstDrowning) <> 0 then |
1257 if (Gear^.State and gstDrowning) <> 0 then |
1206 begin |
1258 begin |
1207 Gear^.doStep := @doStepShotIdle; |
1259 Gear^.doStep := @doStepShotIdle; |
1208 exit |
1260 break; |
1209 end; |
1261 end; |
1210 dec(i) |
1262 dec(i) |
1211 until i = 0; |
1263 until i = 0; |
|
1264 |
|
1265 ShotgunLineHitHelp(Gear, oX, oY, Gear^.X, Gear^.Y); |
|
1266 |
1212 if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then |
1267 if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then |
1213 Gear^.doStep := @doStepShotIdle |
1268 Gear^.doStep := @doStepShotIdle |
1214 end; |
1269 end; |
1215 |
1270 |
1216 //////////////////////////////////////////////////////////////////////////////// |
1271 //////////////////////////////////////////////////////////////////////////////// |