1412 Gear^.dX := _0; |
1412 Gear^.dX := _0; |
1413 Gear^.dY := _0 |
1413 Gear^.dY := _0 |
1414 end; |
1414 end; |
1415 CalcRotationDirAngle(Gear); |
1415 CalcRotationDirAngle(Gear); |
1416 AllInactive := false |
1416 AllInactive := false |
1417 end |
1417 end |
1418 else |
1418 else if (GameTicks and $3F) = 25 then |
1419 if ((GameTicks and $3F) = 25) then |
1419 doStepFallingGear(Gear); |
1420 doStepFallingGear(Gear); |
|
1421 if (Gear^.Health = 0) then |
1420 if (Gear^.Health = 0) then |
1422 begin |
1421 begin |
1423 if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then |
1422 if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then |
1424 inc(Gear^.Damage, hwRound(Gear^.dY * _70)) |
1423 inc(Gear^.Damage, hwRound(Gear^.dY * _70)) |
1425 |
1424 else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then |
1426 else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then |
1425 inc(Gear^.Damage, hwRound(Gear^.dX * _70)) |
1427 inc(Gear^.Damage, hwRound(Gear^.dX * _70)) |
1426 else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then |
1428 |
1427 inc(Gear^.Damage, hwRound(Gear^.dY * -_70)) |
1429 else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then |
1428 else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then |
1430 inc(Gear^.Damage, hwRound(Gear^.dY * -_70)) |
1429 inc(Gear^.Damage, hwRound(Gear^.dX * -_70)); |
1431 |
|
1432 else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then |
|
1433 inc(Gear^.Damage, hwRound(Gear^.dX * -_70)); |
|
1434 |
1430 |
1435 if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then |
1431 if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then |
1436 begin |
1432 begin |
1437 vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
1433 vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
1438 if vg <> nil then |
1434 if vg <> nil then |
1439 vg^.Scale:= 0.5 |
1435 vg^.Scale:= 0.5 |
1440 end; |
1436 end; |
1441 |
1437 |
1442 if (Gear^.Damage > 35) then |
1438 if (Gear^.Damage > 35) then |
1443 begin |
1439 begin |
1444 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); |
1440 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); |
1445 DeleteGear(Gear); |
1441 DeleteGear(Gear); |
4685 RecountTeamHealth(resgear^.Hedgehog^.Team); |
4681 RecountTeamHealth(resgear^.Hedgehog^.Team); |
4686 resgear^.Hedgehog^.Effects[heResurrected]:= 1; |
4682 resgear^.Hedgehog^.Effects[heResurrected]:= 1; |
4687 // only make hat-less hedgehogs look like zombies, preserve existing hats |
4683 // only make hat-less hedgehogs look like zombies, preserve existing hats |
4688 |
4684 |
4689 if resgear^.Hedgehog^.Hat = 'NoHat' then |
4685 if resgear^.Hedgehog^.Hat = 'NoHat' then |
4690 LoadHedgehogHat(resgear, 'Reserved/Zombie'); |
4686 LoadHedgehogHat(resgear^.Hedgehog^, 'Reserved/Zombie'); |
4691 end; |
4687 end; |
4692 |
4688 |
4693 hh^.Gear^.dY := _0; |
4689 hh^.Gear^.dY := _0; |
4694 hh^.Gear^.dX := _0; |
4690 hh^.Gear^.dX := _0; |
4695 doStepHedgehogMoving(hh^.Gear); |
4691 doStepHedgehogMoving(hh^.Gear); |
5243 end; |
5239 end; |
5244 end; |
5240 end; |
5245 end; |
5241 end; |
5246 |
5242 |
5247 //////////////////////////////////////////////////////////////////////////////// |
5243 //////////////////////////////////////////////////////////////////////////////// |
|
5244 procedure doStepKnife(Gear: PGear); |
|
5245 var ox, oy: LongInt; |
|
5246 la: hwFloat; |
|
5247 begin |
|
5248 // Gear is shrunk so it can actually escape the hog without carving into the terrain |
|
5249 if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16; |
|
5250 if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then |
|
5251 begin |
|
5252 DeleteCI(Gear); |
|
5253 // used for damage and impact calc. needs balancing I think |
|
5254 Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4)); |
|
5255 doStepFallingGear(Gear); |
|
5256 AllInactive := false; |
|
5257 CalcRotationDirAngle(Gear) |
|
5258 end |
|
5259 else if Gear^.CollisionIndex = -1 then |
|
5260 begin |
|
5261 ox:= 0; oy:= 0; |
|
5262 if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1 |
|
5263 else if TestCollisionXwithGear(Gear, 1) then ox:= 1 |
|
5264 else if TestCollisionXwithGear(Gear, -1) then ox:= -1 |
|
5265 else if TestCollisionYwithGear(Gear, 1) <> 0 then oy:= 1; |
|
5266 if Gear^.Health > 0 then |
|
5267 PlaySound(sndRopeAttach); |
|
5268 la:= _0; |
|
5269 if (ox <> 0) or (oy <> 0) then |
|
5270 la:= CalcSlopeNearGear(Gear, ox, oy); |
|
5271 if la = _0 then |
|
5272 begin |
|
5273 // debug for when we couldn't get an angle |
|
5274 //AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite); |
|
5275 Gear^.DirAngle:= DxDy2Angle(Gear^.dX, Gear^.dY)*hwSign(Gear^.dX) + (random(20)-10) |
|
5276 end |
|
5277 else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent? |
|
5278 Gear^.dX:= _0; |
|
5279 Gear^.dY:= _0; |
|
5280 Gear^.State:= Gear^.State and (not gstMoving) or gstCollision; |
|
5281 Gear^.Radius:= 20; |
|
5282 if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0); |
|
5283 Gear^.Radius:= 16; |
|
5284 Gear^.Health:= 0; |
|
5285 AddGearCI(Gear) |
|
5286 end |
|
5287 else if GameTicks and $3F = 0 then |
|
5288 begin |
|
5289 if (TestCollisionYwithGear(Gear, -1) = 0) |
|
5290 and not TestCollisionXwithGear(Gear, 1) |
|
5291 and not TestCollisionXwithGear(Gear, -1) |
|
5292 and (TestCollisionYwithGear(Gear, 1) = 0) then Gear^.State:= Gear^.State and (not gstCollision) or gstMoving; |
|
5293 end |
|
5294 end; |
|
5295 (* |
|
5296 This didn't end up getting used, but, who knows, might be reasonable for javellin or something |
5248 // Make the knife initial angle based on the hog attack angle, or is that too hard? |
5297 // Make the knife initial angle based on the hog attack angle, or is that too hard? |
5249 procedure doStepKnife(Gear: PGear); |
5298 procedure doStepKnife(Gear: PGear); |
5250 var t, |
5299 var t, |
5251 gx, gy, ga, // gear x,y,angle |
5300 gx, gy, ga, // gear x,y,angle |
5252 lx, ly, la, // land x,y,angle |
5301 lx, ly, la, // land x,y,angle |