1252 Gear^.State:= Gear^.State or gstAnimation; |
1252 Gear^.State:= Gear^.State or gstAnimation; |
1253 if ((Gear^.dX.QWordValue <> 0) or (Gear^.dY.QWordValue <> 0)) then |
1253 if ((Gear^.dX.QWordValue <> 0) or (Gear^.dY.QWordValue <> 0)) then |
1254 begin |
1254 begin |
1255 DeleteCI(Gear); |
1255 DeleteCI(Gear); |
1256 AllInactive:= false; |
1256 AllInactive:= false; |
1257 if Gear^.dY.isNegative and (Gear^.dY < -_0_02) and TestCollisionYwithGear(Gear, -1) then |
1257 if not Gear^.dY.isNegative and (Gear^.dY > _0_03) and TestCollisionYwithGear(Gear, 1) then |
1258 inc(Gear^.Damage, hwRound(Gear^.dY * _70) * -1); |
|
1259 if not Gear^.dY.isNegative and (Gear^.dY > _0_02) and TestCollisionYwithGear(Gear, 1) then |
|
1260 begin |
1258 begin |
1261 inc(Gear^.Damage, hwRound(Gear^.dY * _70)); |
1259 inc(Gear^.Damage, hwRound(Gear^.dY * _30)); |
1262 for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do |
1260 for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do |
1263 begin |
1261 begin |
1264 particle:= AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
1262 particle:= AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
1265 if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX / 5) |
1263 if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX / 5) |
1266 end |
1264 end |
1267 end; |
1265 end |
1268 if Gear^.dX.isNegative and (Gear^.dX < -_0_02) and TestCollisionXwithGear(Gear, -1) then |
1266 else if not Gear^.dX.isNegative and (Gear^.dX > _0_03) and TestCollisionXwithGear(Gear, 1) then |
1269 inc(Gear^.Damage, hwRound(Gear^.dX * _70)*-1); |
1267 inc(Gear^.Damage, hwRound(Gear^.dX * _30)) |
1270 if not Gear^.dX.isNegative and (Gear^.dX > _0_02) and TestCollisionYwithGear(Gear, 1) then |
1268 else if Gear^.dY.isNegative and (Gear^.dY < -_0_03) and TestCollisionYwithGear(Gear, -1) then |
1271 inc(Gear^.Damage, hwRound(Gear^.dX * _70)); |
1269 inc(Gear^.Damage, hwRound(Gear^.dY * -_30)) |
|
1270 else if Gear^.dX.isNegative and (Gear^.dX < -_0_03) and TestCollisionXwithGear(Gear, -1) then |
|
1271 inc(Gear^.Damage, hwRound(Gear^.dX * -_30)); |
1272 if Gear^.Damage <> 0 then PlaySound(sndGraveImpact); |
1272 if Gear^.Damage <> 0 then PlaySound(sndGraveImpact); |
1273 doStepFallingGear(Gear); |
1273 doStepFallingGear(Gear); |
1274 CalcRotationDirAngle(Gear); |
1274 CalcRotationDirAngle(Gear); |
1275 CheckGearDrowning(Gear) |
1275 CheckGearDrowning(Gear) |
1276 end |
1276 end |
1277 else AddGearCI(Gear); |
1277 else AddGearCI(Gear); |
|
1278 (* |
|
1279 Attempt to make a barrel knock itself over an edge. Would need more checks to avoid issues like burn damage |
|
1280 begin |
|
1281 x:= hwRound(Gear^.X); |
|
1282 y:= hwRound(Gear^.Y); |
|
1283 if (((y+1) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) then |
|
1284 if (Land[y+1, x] = 0) then |
|
1285 begin |
|
1286 if (((y+1) and LAND_HEIGHT_MASK) = 0) and (((x+Gear^.Radius-2) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x+Gear^.Radius-2] = 0) then |
|
1287 Gear^.dX:= -_0_08 |
|
1288 else if (((y+1 and LAND_HEIGHT_MASK)) = 0) and (((x-(Gear^.Radius-2)) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x-(Gear^.Radius-2)] = 0) then |
|
1289 Gear^.dX:= _0_08; |
|
1290 end; |
|
1291 if Gear^.dX.QWordValue = 0 then AddGearCI(Gear) |
|
1292 end; *) |
|
1293 |
|
1294 if not Gear^.dY.isNegative and (Gear^.dY < _0_001) and TestCollisionYwithGear(Gear, 1) then Gear^.dY:= _0; |
|
1295 if hwAbs(Gear^.dX) < _0_001 then Gear^.dX:= _0; |
1278 |
1296 |
1279 if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
1297 if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
1280 if (cBarrelHealth div Gear^.Health) > 2 then |
1298 if (cBarrelHealth div Gear^.Health) > 2 then |
1281 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
1299 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
1282 else |
1300 else |
1356 if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then SetAllHHToActive; |
1374 if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then SetAllHHToActive; |
1357 if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; |
1375 if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; |
1358 if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then |
1376 if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then |
1359 begin |
1377 begin |
1360 if (Gear^.dY > _0_02) and (k = gtExplosives) then |
1378 if (Gear^.dY > _0_02) and (k = gtExplosives) then |
1361 inc(Gear^.Damage, hwRound(Gear^.dY * _70)); |
1379 inc(Gear^.Damage, hwRound(Gear^.dY * _30)); |
1362 |
1380 |
1363 if Gear^.dY > _0_2 then |
1381 if Gear^.dY > _0_2 then |
1364 for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do |
1382 for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do |
1365 AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
1383 AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
1366 Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
1384 Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |