branch | webgl |
changeset 8833 | c13ebed437cb |
parent 8446 | c18ba8726f5a |
parent 8822 | fc9877ff7f1a |
child 8839 | caa57115d7ea |
8450:404ddce27b23 | 8833:c13ebed437cb |
---|---|
90 if (CurrentHedgehog^.Gear = gi) then |
90 if (CurrentHedgehog^.Gear = gi) then |
91 PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack) |
91 PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack) |
92 |
92 |
93 else |
93 else |
94 begin |
94 begin |
95 if (gi^.State and gstMoving) = 0 then |
95 if ((gi^.State and gstMoving) = 0) and (gi^.Hedgehog^.Effects[heFrozen] = 0) then |
96 begin |
96 begin |
97 gi^.dX.isNegative:= X<gi^.X; |
97 gi^.dX.isNegative:= X<gi^.X; |
98 gi^.State := gi^.State or gstLoser; |
98 gi^.State := gi^.State or gstLoser; |
99 end; |
99 end; |
100 |
100 |
614 move:=true |
614 move:=true |
615 // Solid pixel encountered |
615 // Solid pixel encountered |
616 else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then |
616 else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then |
617 begin |
617 begin |
618 lf:= Land[yy, xx] and (lfObject or lfBasic or lfIndestructible); |
618 lf:= Land[yy, xx] and (lfObject or lfBasic or lfIndestructible); |
619 if lf = 0 then lf:= lfObject; |
|
619 // If there's room below keep falling |
620 // If there's room below keep falling |
620 if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then |
621 if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then |
621 begin |
622 begin |
622 X:= X - cWindSpeed * 1600 - dX; |
623 X:= X - cWindSpeed * 1600 - dX; |
623 end |
624 end |
677 ry:= ly; |
678 ry:= ly; |
678 if cReducedQuality and rqBlurryLand <> 0 then |
679 if cReducedQuality and rqBlurryLand <> 0 then |
679 begin |
680 begin |
680 rx:= rx div 2;ry:= ry div 2; |
681 rx:= rx div 2;ry:= ry div 2; |
681 end; |
682 end; |
682 if Land[yy + py, xx + px] and $FF00 = 0 then |
683 if Land[yy + py, xx + px] <= lfAllObjMask then |
683 if gun then |
684 if gun then |
684 begin |
685 begin |
685 LandDirty[yy div 32, xx div 32]:= 1; |
686 LandDirty[yy div 32, xx div 32]:= 1; |
686 if LandPixels[ry, rx] = 0 then |
687 if LandPixels[ry, rx] = 0 then |
687 Land[ly, lx]:= lfDamaged or lfObject |
688 Land[ly, lx]:= lfDamaged or lfObject |
1018 y := hwRound(Gear^.Y); |
1019 y := hwRound(Gear^.Y); |
1019 |
1020 |
1020 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] <> 0) then |
1021 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] <> 0) then |
1021 inc(Gear^.Damage); |
1022 inc(Gear^.Damage); |
1022 // let's interrupt before a collision to give portals a chance to catch the bullet |
1023 // let's interrupt before a collision to give portals a chance to catch the bullet |
1023 if (Gear^.Damage = 1) and (Gear^.Tag = 0) and (Land[y, x] > 255) then |
1024 if (Gear^.Damage = 1) and (Gear^.Tag = 0) and not(CheckLandValue(x, y, lfLandMask)) then |
1024 begin |
1025 begin |
1025 Gear^.Tag := 1; |
1026 Gear^.Tag := 1; |
1026 Gear^.Damage := 0; |
1027 Gear^.Damage := 0; |
1027 Gear^.X := Gear^.X - Gear^.dX; |
1028 Gear^.X := Gear^.X - Gear^.dX; |
1028 Gear^.Y := Gear^.Y - Gear^.dY; |
1029 Gear^.Y := Gear^.Y - Gear^.dY; |
1151 procedure doStepActionTimer(Gear: PGear); |
1152 procedure doStepActionTimer(Gear: PGear); |
1152 begin |
1153 begin |
1153 dec(Gear^.Timer); |
1154 dec(Gear^.Timer); |
1154 case Gear^.Kind of |
1155 case Gear^.Kind of |
1155 gtATStartGame: |
1156 gtATStartGame: |
1156 begin |
1157 begin |
1157 AllInactive := false; |
1158 AllInactive := false; |
1158 if Gear^.Timer = 0 then |
1159 if Gear^.Timer = 0 then |
1159 begin |
1160 begin |
1160 AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState); |
1161 AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState); |
1161 end |
1162 end |
1162 end; |
1163 end; |
1163 gtATFinishGame: |
1164 gtATFinishGame: |
1164 begin |
1165 begin |
1165 AllInactive := false; |
1166 AllInactive := false; |
1166 if Gear^.Timer = 1000 then |
1167 if Gear^.Timer = 1000 then |
1167 begin |
1168 begin |
1168 ScreenFade := sfToBlack; |
1169 ScreenFade := sfToBlack; |
1169 ScreenFadeValue := 0; |
1170 ScreenFadeValue := 0; |
1173 begin |
1174 begin |
1174 SendIPC(_S'N'); |
1175 SendIPC(_S'N'); |
1175 SendIPC(_S'q'); |
1176 SendIPC(_S'q'); |
1176 GameState := gsExit |
1177 GameState := gsExit |
1177 end |
1178 end |
1179 end; |
|
1178 end; |
1180 end; |
1179 end; |
|
1180 if Gear^.Timer = 0 then |
1181 if Gear^.Timer = 0 then |
1181 DeleteGear(Gear) |
1182 DeleteGear(Gear) |
1182 end; |
1183 end; |
1183 |
1184 |
1184 //////////////////////////////////////////////////////////////////////////////// |
1185 //////////////////////////////////////////////////////////////////////////////// |
1240 SetLittle(HHGear^.dX); |
1241 SetLittle(HHGear^.dX); |
1241 HHGear^.dY := _0; |
1242 HHGear^.dY := _0; |
1242 end |
1243 end |
1243 else |
1244 else |
1244 begin |
1245 begin |
1245 if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y + Gear^.dY + cGravity), $FF00) then |
1246 if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y + Gear^.dY + cGravity), lfLandMask) then |
1246 begin |
1247 begin |
1247 Gear^.dY := Gear^.dY + cGravity; |
1248 Gear^.dY := Gear^.dY + cGravity; |
1248 Gear^.Y := Gear^.Y + Gear^.dY |
1249 Gear^.Y := Gear^.Y + Gear^.dY |
1249 end; |
1250 end; |
1250 if hwRound(Gear^.Y) > cWaterLine then |
1251 if hwRound(Gear^.Y) > cWaterLine then |
1251 Gear^.Timer := 1 |
1252 Gear^.Timer := 1 |
1252 end; |
1253 end; |
1253 |
1254 |
1254 Gear^.X := Gear^.X + HHGear^.dX; |
1255 Gear^.X := Gear^.X + HHGear^.dX; |
1255 if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)-cHHRadius, $FF00) then |
1256 if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)-cHHRadius, lfLandMask) then |
1256 begin |
1257 begin |
1257 HHGear^.X := Gear^.X; |
1258 HHGear^.X := Gear^.X; |
1258 HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius) |
1259 HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius) |
1259 end; |
1260 end; |
1260 |
1261 |
1399 HHGear: PGear; |
1400 HHGear: PGear; |
1400 begin |
1401 begin |
1401 BTPrevAngle := High(LongInt); |
1402 BTPrevAngle := High(LongInt); |
1402 BTSteps := 0; |
1403 BTSteps := 0; |
1403 HHGear := Gear^.Hedgehog^.Gear; |
1404 HHGear := Gear^.Hedgehog^.Gear; |
1405 HedgehogChAngle(HHGear); |
|
1406 Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX); |
|
1407 Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5); |
|
1408 DrawTunnel(HHGear^.X, |
|
1409 HHGear^.Y + Gear^.dY * cHHRadius - _1 - |
|
1410 ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7), |
|
1411 Gear^.dX, Gear^.dY, |
|
1412 cHHStepTicks, cHHRadius * 2 + 7); |
|
1404 HHGear^.Message := 0; |
1413 HHGear^.Message := 0; |
1405 HHGear^.State := HHGear^.State or gstNotKickable; |
1414 HHGear^.State := HHGear^.State or gstNotKickable; |
1406 Gear^.doStep := @doStepBlowTorchWork |
1415 Gear^.doStep := @doStepBlowTorchWork |
1407 end; |
1416 end; |
1408 |
1417 |
1782 Gear^.dY := _0; |
1791 Gear^.dY := _0; |
1783 |
1792 |
1784 Gear^.Y := Gear^.Y + Gear^.dY; |
1793 Gear^.Y := Gear^.Y + Gear^.dY; |
1785 |
1794 |
1786 if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then |
1795 if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then |
1787 SetAllHHToActive; |
1796 SetAllHHToActive(false); |
1788 |
1797 |
1789 if (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0) then |
1798 if (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0) then |
1790 begin |
1799 begin |
1791 if (Gear^.dY > _0_2) and (k = gtExplosives) then |
1800 if (Gear^.dY > _0_2) and (k = gtExplosives) then |
1792 inc(Gear^.Damage, hwRound(Gear^.dY * _70)); |
1801 inc(Gear^.Damage, hwRound(Gear^.dY * _70)); |
2383 |
2392 |
2384 PlaySound(sndSwitchHog); |
2393 PlaySound(sndSwitchHog); |
2385 |
2394 |
2386 repeat |
2395 repeat |
2387 CurrentTeam^.CurrHedgehog := Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber); |
2396 CurrentTeam^.CurrHedgehog := Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber); |
2388 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0); |
2397 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and |
2398 (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0) and |
|
2399 (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen]=0); |
|
2389 |
2400 |
2390 SwitchCurrentHedgehog(@CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]); |
2401 SwitchCurrentHedgehog(@CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]); |
2391 AmmoMenuInvalidated:= true; |
2402 AmmoMenuInvalidated:= true; |
2392 |
2403 |
2393 HHGear := CurrentHedgehog^.Gear; |
2404 HHGear := CurrentHedgehog^.Gear; |
2416 end |
2427 end |
2417 end; |
2428 end; |
2418 |
2429 |
2419 //////////////////////////////////////////////////////////////////////////////// |
2430 //////////////////////////////////////////////////////////////////////////////// |
2420 procedure doStepMortar(Gear: PGear); |
2431 procedure doStepMortar(Gear: PGear); |
2421 var |
2432 var |
2422 dX, dY, gdX, gdY: hwFloat; |
2433 dX, dY, gdX, gdY: hwFloat; |
2423 i: LongInt; |
2434 i: LongInt; |
2424 dxn, dyn: boolean; |
2435 dxn, dyn: boolean; |
2425 begin |
2436 begin |
2426 AllInactive := false; |
2437 AllInactive := false; |
2743 begin |
2754 begin |
2744 AllInactive := false; |
2755 AllInactive := false; |
2745 |
2756 |
2746 HHGear := Gear^.Hedgehog^.Gear; |
2757 HHGear := Gear^.Hedgehog^.Gear; |
2747 HHGear^.Message := HHGear^.Message and (not gmAttack); |
2758 HHGear^.Message := HHGear^.Message and (not gmAttack); |
2748 Gear^.CollisionMask:= $FF7F; |
2759 Gear^.CollisionMask:= lfNotCurrentMask; |
2749 |
2760 |
2750 FollowGear := Gear; |
2761 FollowGear := Gear; |
2751 |
2762 |
2752 Gear^.doStep := @doStepCakeFall |
2763 Gear^.doStep := @doStepCakeFall |
2753 end; |
2764 end; |
2877 forward; |
2888 forward; |
2878 |
2889 |
2879 procedure doStepDrillDrilling(Gear: PGear); |
2890 procedure doStepDrillDrilling(Gear: PGear); |
2880 var |
2891 var |
2881 t: PGearArray; |
2892 t: PGearArray; |
2882 ox, oy: hwFloat; |
2893 tempColl: Word; |
2883 begin |
2894 begin |
2884 AllInactive := false; |
2895 AllInactive := false; |
2885 |
2896 if (Gear^.Timer > 0) and (Gear^.Timer mod 10 <> 0) then |
2886 if (Gear^.Timer > 0) and ((Gear^.Timer mod 10) = 0) then |
2897 begin |
2887 begin |
2898 dec(Gear^.Timer); |
2888 ox := Gear^.X; |
2899 exit; |
2889 oy := Gear^.Y; |
2900 end; |
2890 Gear^.X := Gear^.X + Gear^.dX; |
2901 |
2891 Gear^.Y := Gear^.Y + Gear^.dY; |
2902 DrawTunnel(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 2, 6); |
2892 DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6); |
2903 Gear^.X := Gear^.X + Gear^.dX; |
2893 if (Gear^.Timer mod 30) = 0 then |
2904 Gear^.Y := Gear^.Y + Gear^.dY; |
2894 AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust); |
2905 if (Gear^.Timer mod 30) = 0 then |
2895 if (CheckGearDrowning(Gear)) then |
2906 AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust); |
2896 begin |
2907 if (CheckGearDrowning(Gear)) then |
2897 StopSoundChan(Gear^.SoundChannel); |
2908 begin |
2898 exit |
2909 StopSoundChan(Gear^.SoundChannel); |
2899 end |
2910 exit |
2900 end; |
2911 end; |
2901 |
2912 |
2902 if GameTicks > Gear^.FlightTime then |
2913 tempColl:= Gear^.CollisionMask; |
2914 Gear^.CollisionMask:= $007F; |
|
2915 if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) <> 0) or TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) or (GameTicks > Gear^.FlightTime) then |
|
2903 t := CheckGearsCollision(Gear) |
2916 t := CheckGearsCollision(Gear) |
2904 |
|
2905 else t := nil; |
2917 else t := nil; |
2918 Gear^.CollisionMask:= tempColl; |
|
2906 //fixes drill not exploding when touching HH bug |
2919 //fixes drill not exploding when touching HH bug |
2907 |
2920 |
2908 if (Gear^.Timer = 0) or ((t <> nil) and (t^.Count <> 0)) |
2921 if (Gear^.Timer = 0) or ((t <> nil) and (t^.Count <> 0)) |
2909 or ( ((Gear^.State and gsttmpFlag) = 0) and (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))) |
2922 or ( ((Gear^.State and gsttmpFlag) = 0) and (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))) |
2910 // CheckLandValue returns true if the type isn't matched |
2923 // CheckLandValue returns true if the type isn't matched |
3014 begin |
3027 begin |
3015 rx := rndSign(getRandomf * _0_1); |
3028 rx := rndSign(getRandomf * _0_1); |
3016 ry := rndSign(getRandomf * _0_1); |
3029 ry := rndSign(getRandomf * _0_1); |
3017 |
3030 |
3018 ball:= AddGear(gx, gy, gtBall, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0); |
3031 ball:= AddGear(gx, gy, gtBall, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0); |
3019 ball^.CollisionMask:= $FF7F; |
3032 ball^.CollisionMask:= lfNotCurrentMask; |
3020 |
3033 |
3021 PlaySound(sndGun); |
3034 PlaySound(sndGun); |
3022 end; |
3035 end; |
3023 |
3036 |
3024 if (Gear^.Timer = 0) or ((HHGear^.State and gstHHDriven) = 0) then |
3037 if (Gear^.Timer = 0) or ((HHGear^.State and gstHHDriven) = 0) then |
3586 hasdxy, isbullet, iscake, isCollision: Boolean; |
3599 hasdxy, isbullet, iscake, isCollision: Boolean; |
3587 begin |
3600 begin |
3588 doPortalColorSwitch(); |
3601 doPortalColorSwitch(); |
3589 |
3602 |
3590 // destroy portal if ground it was attached too is gone |
3603 // destroy portal if ground it was attached too is gone |
3591 if ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) = 0) |
3604 if (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] <= lfAllObjMask) |
3592 or (Gear^.Timer < 1) |
3605 or (Gear^.Timer < 1) |
3593 or (Gear^.Hedgehog^.Team <> CurrentHedgehog^.Team) |
3606 or (Gear^.Hedgehog^.Team <> CurrentHedgehog^.Team) |
3594 or (hwRound(Gear^.Y) > cWaterLine) then |
3607 or (hwRound(Gear^.Y) > cWaterLine) then |
3595 begin |
3608 begin |
3596 deleteGear(Gear); |
3609 deleteGear(Gear); |
3626 // end of list? |
3639 // end of list? |
3627 if iterator = nil then |
3640 if iterator = nil then |
3628 break; |
3641 break; |
3629 |
3642 |
3630 // don't port portals or other gear that wouldn't make sense |
3643 // don't port portals or other gear that wouldn't make sense |
3631 if (iterator^.Kind in [gtPortal, gtRope, gtAirAttack]) |
3644 if (iterator^.Kind in [gtPortal, gtRope, gtAirAttack, gtIceGun]) |
3632 or (iterator^.PortalCounter > 32) then |
3645 or (iterator^.PortalCounter > 32) then |
3633 continue; |
3646 continue; |
3634 |
3647 |
3635 // don't port hogs on rope |
3648 // don't port hogs on rope |
3636 // TODO: this will also prevent hogs while falling after rope use from |
3649 // TODO: this will also prevent hogs while falling after rope use from |
4369 speed := _0_5 * (_10 / Gear^.Tag); |
4382 speed := _0_5 * (_10 / Gear^.Tag); |
4370 |
4383 |
4371 flame:= AddGear(gx, gy, gtFlame, gstTmpFlag, |
4384 flame:= AddGear(gx, gy, gtFlame, gstTmpFlag, |
4372 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4385 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4373 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4386 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4374 flame^.CollisionMask:= $FF7F; |
4387 flame^.CollisionMask:= lfNotCurrentMask; |
4375 |
4388 |
4376 if (Gear^.Health mod 30) = 0 then |
4389 if (Gear^.Health mod 30) = 0 then |
4377 begin |
4390 begin |
4378 flame:= AddGear(gx, gy, gtFlame, 0, |
4391 flame:= AddGear(gx, gy, gtFlame, 0, |
4379 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4392 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4380 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4393 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4381 flame^.CollisionMask:= $FF7F; |
4394 flame^.CollisionMask:= lfNotCurrentMask; |
4382 end |
4395 end |
4383 end; |
4396 end; |
4384 Gear^.Timer:= Gear^.Tag |
4397 Gear^.Timer:= Gear^.Tag |
4385 end; |
4398 end; |
4386 |
4399 |
4453 speed := (_3 / Gear^.Tag); |
4466 speed := (_3 / Gear^.Tag); |
4454 |
4467 |
4455 land:= AddGear(gx, gy, gtFlake, gstTmpFlag, |
4468 land:= AddGear(gx, gy, gtFlake, gstTmpFlag, |
4456 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4469 SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
4457 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4470 AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
4458 land^.CollisionMask:= $FF7F; |
4471 land^.CollisionMask:= lfNotCurrentMask; |
4459 |
4472 |
4460 Gear^.Timer:= Gear^.Tag |
4473 Gear^.Timer:= Gear^.Tag |
4461 end; |
4474 end; |
4462 |
4475 |
4463 if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) or ((HHGear^.Message and gmAttack) <> 0) then |
4476 if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) or ((HHGear^.Message and gmAttack) <> 0) then |
4577 end; |
4590 end; |
4578 |
4591 |
4579 if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9) |
4592 if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9) |
4580 , lfIndestructible) then |
4593 , lfIndestructible) then |
4581 begin |
4594 begin |
4582 Gear^.X := Gear^.X + Gear^.dX; |
4595 //Gear^.X := Gear^.X + Gear^.dX; |
4583 Gear^.Y := Gear^.Y + _1_9; |
4596 Gear^.Y := Gear^.Y + _1_9 |
4584 end; |
4597 end; |
4585 end; |
4598 end; |
4586 if TestCollisionYwithGear(Gear, 1) <> 0 then |
4599 if TestCollisionYwithGear(Gear, 1) <> 0 then |
4587 begin |
4600 begin |
4588 Gear^.dY := _0; |
4601 Gear^.dY := _0; |
4589 SetLittle(HitGear^.dX); |
4602 SetLittle(HitGear^.dX); |
4590 HitGear^.dY := _0; |
4603 HitGear^.dY := _0; |
4591 end |
4604 end |
4592 else |
4605 else |
4593 begin |
4606 begin |
4594 Gear^.dY := Gear^.dY + cGravity; |
4607 //Gear^.dY := Gear^.dY + cGravity; |
4595 Gear^.Y := Gear^.Y + Gear^.dY; |
4608 //Gear^.Y := Gear^.Y + Gear^.dY; |
4596 if hwRound(Gear^.Y) > cWaterLine then |
4609 if hwRound(Gear^.Y) > cWaterLine then |
4597 Gear^.Timer := 1 |
4610 Gear^.Timer := 1 |
4598 end; |
4611 end; |
4599 |
4612 |
4600 Gear^.X := Gear^.X + HitGear^.dX; |
4613 //Gear^.X := Gear^.X + HitGear^.dX; |
4601 HitGear^.X := Gear^.X; |
4614 HitGear^.X := Gear^.X; |
4615 HitGear^.Y := Gear^.Y; |
|
4602 SetLittle(HitGear^.dY); |
4616 SetLittle(HitGear^.dY); |
4603 HitGear^.Active:= true; |
4617 HitGear^.Active:= true; |
4604 end; |
4618 end; |
4605 |
4619 |
4606 procedure doStepHammerHit(Gear: PGear); |
4620 procedure doStepHammerHit(Gear: PGear); |
4725 end; |
4739 end; |
4726 |
4740 |
4727 procedure doStepResurrector(Gear: PGear); |
4741 procedure doStepResurrector(Gear: PGear); |
4728 var |
4742 var |
4729 graves: PGearArrayS; |
4743 graves: PGearArrayS; |
4744 hh: PHedgehog; |
|
4730 i: LongInt; |
4745 i: LongInt; |
4731 len: Integer; |
4746 len: Integer; |
4732 begin |
4747 begin |
4733 AllInactive := false; |
4748 AllInactive := false; |
4734 graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius); |
4749 graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius); |
4735 |
4750 |
4736 if graves.size > 0 then |
4751 if graves.size > 0 then |
4737 begin |
4752 begin |
4753 hh := Gear^.Hedgehog; |
|
4738 for i:= 0 to graves.size - 1 do |
4754 for i:= 0 to graves.size - 1 do |
4739 begin |
4755 begin |
4740 PHedgehog(graves.ar^[i]^.Hedgehog)^.Gear := nil; |
4756 PHedgehog(graves.ar^[i]^.Hedgehog)^.Gear := nil; |
4741 graves.ar^[i]^.Health := 0; |
4757 graves.ar^[i]^.Health := 0; |
4742 end; |
4758 end; |
4743 Gear^.doStep := @doStepResurrectorWork; |
4759 Gear^.doStep := @doStepResurrectorWork; |
4760 if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then |
|
4761 begin |
|
4762 if LongInt(graves.size) <= Gear^.Tag then Gear^.Tag:= 0; |
|
4763 dec(hh^.Gear^.Health); |
|
4764 if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then |
|
4765 hh^.Gear^.Damage:= 1; |
|
4766 RenderHealth(hh^); |
|
4767 RecountTeamHealth(hh^.Team); |
|
4768 inc(graves.ar^[Gear^.Tag]^.Health); |
|
4769 inc(Gear^.Tag) |
|
4770 end |
|
4744 end |
4771 end |
4745 else |
4772 else |
4746 begin |
4773 begin |
4747 StopSoundChan(Gear^.SoundChannel); |
4774 StopSoundChan(Gear^.SoundChannel); |
4748 Gear^.Timer := 250; |
4775 Gear^.Timer := 250; |
4951 DeleteGear(Gear); |
4978 DeleteGear(Gear); |
4952 exit |
4979 exit |
4953 end; |
4980 end; |
4954 Gear^.Pos:= 4; |
4981 Gear^.Pos:= 4; |
4955 // This condition might need tweaking |
4982 // This condition might need tweaking |
4956 Gear^.Timer:= GetRandom(cHedgehogTurnTime*TeamsCount*2)+cHedgehogTurnTime*2 |
4983 Gear^.Timer:= GetRandom(cHedgehogTurnTime*TeamsCount)+cHedgehogTurnTime |
4957 end; |
4984 end; |
4958 |
4985 |
4959 if (Gear^.Pos = 4) then |
4986 if (Gear^.Pos = 4) then |
4960 begin |
4987 begin |
4961 cnt:= 0; |
4988 cnt:= 0; |
4987 Gear^.SoundChannel := LoopSound(sndTardis); |
5014 Gear^.SoundChannel := LoopSound(sndTardis); |
4988 Gear^.Pos:= 1; |
5015 Gear^.Pos:= 1; |
4989 Gear^.Power:= 0; |
5016 Gear^.Power:= 0; |
4990 end |
5017 end |
4991 end |
5018 end |
4992 else dec(Gear^.Timer); |
5019 else if (CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan) then dec(Gear^.Timer) |
4993 end; |
5020 end; |
4994 |
5021 |
4995 end; |
5022 end; |
4996 |
5023 |
4997 procedure doStepTardis(Gear: PGear); |
5024 procedure doStepTardis(Gear: PGear); |
5045 WIP. The ice gun will have the following effects. It has been proposed by sheepluva that it take the appearance of a large freezer |
5072 WIP. The ice gun will have the following effects. It has been proposed by sheepluva that it take the appearance of a large freezer |
5046 spewing ice cubes. The cubes will be visual gears only. The scatter from them and the impact snow dust should help hide imprecisions in things like the GearsNear effect. |
5073 spewing ice cubes. The cubes will be visual gears only. The scatter from them and the impact snow dust should help hide imprecisions in things like the GearsNear effect. |
5047 For now we assume a "ray" like a deagle projected out from the gun. |
5074 For now we assume a "ray" like a deagle projected out from the gun. |
5048 All these effects assume the ray's angle is not changed and that the target type was unchanged over a number of ticks. This is a simplifying assumption for "gun was applying freezing effect to the same target". |
5075 All these effects assume the ray's angle is not changed and that the target type was unchanged over a number of ticks. This is a simplifying assumption for "gun was applying freezing effect to the same target". |
5049 * When fired at water a layer of ice textured land is added above the water. |
5076 * When fired at water a layer of ice textured land is added above the water. |
5050 * When fired at non-ice land (land and $FF00 and not lfIce) the land is overlaid with a thin layer of ice textured land around that point (say, 1 or 2px into land, 1px above). For attractiveness, a slope would probably be needed. |
5077 * When fired at non-ice land (land and lfLandMask and not lfIce) the land is overlaid with a thin layer of ice textured land around that point (say, 1 or 2px into land, 1px above). For attractiveness, a slope would probably be needed. |
5051 * When fired at a hog (land and $00FF <> 0), while the hog is targetted, the hog's state is set to frozen. As long as the gun is on the hog, a frozen hog sprite creeps up from the feet to the head. If the effect is interrupted before reaching the top, the freezing state is cleared. |
5078 * When fired at a hog (land and $00FF <> 0), while the hog is targetted, the hog's state is set to frozen. As long as the gun is on the hog, a frozen hog sprite creeps up from the feet to the head. If the effect is interrupted before reaching the top, the freezing state is cleared. |
5052 A frozen hog will animate differently. To be decided, but possibly in a similar fashion to a grave when it comes to explosions. The hog might (possibly) not be damaged by explosions. This might make freezing potentially useful for friendlies in a bad position. It might be better to allow damage though. |
5079 A frozen hog will animate differently. To be decided, but possibly in a similar fashion to a grave when it comes to explosions. The hog might (possibly) not be damaged by explosions. This might make freezing potentially useful for friendlies in a bad position. It might be better to allow damage though. |
5053 A frozen hog stays frozen for a certain number of turns. Each turn the frozen overlay becomes fainter, until it fades and the hog animates normally again. |
5080 A frozen hog stays frozen for a certain number of turns. Each turn the frozen overlay becomes fainter, until it fades and the hog animates normally again. |
5054 *) |
5081 *) |
5055 |
5082 |
5083 |
|
5084 procedure updateFuel(Gear: PGear); |
|
5085 var |
|
5086 t:LongInt; |
|
5087 begin |
|
5088 t:= Gear^.Health div 10; |
|
5089 if (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then |
|
5090 begin |
|
5091 Gear^.Damage:= t; |
|
5092 FreeTexture(Gear^.Tex); |
|
5093 Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(t) + |
|
5094 '%', cWhiteColor, fntSmall) |
|
5095 end; |
|
5096 if GameTicks mod 10 = 0 then dec(Gear^.Health); |
|
5097 end; |
|
5098 |
|
5099 |
|
5100 procedure updateTarget(Gear:PGear; newX, newY:HWFloat); |
|
5101 // var |
|
5102 // iter:PGear; |
|
5103 begin |
|
5104 with Gear^ do |
|
5105 begin |
|
5106 dX:= newX; |
|
5107 dY:= newY; |
|
5108 Pos:= 0; |
|
5109 Target.X:= NoPointX; |
|
5110 LastDamage:= nil; |
|
5111 X:= Hedgehog^.Gear^.X; |
|
5112 Y:= Hedgehog^.Gear^.Y; |
|
5113 //unfreeze all semifrozen hogs - make this generic hog cleanup |
|
5114 (* |
|
5115 iter := GearsList; |
|
5116 while iter <> nil do |
|
5117 begin |
|
5118 if (iter^.Kind = gtHedgehog) and |
|
5119 (iter^.Hedgehog^.Effects[heFrozen] and $FF = 0) then |
|
5120 iter^.Hedgehog^.Effects[heFrozen]:= 0; |
|
5121 iter:= iter^.NextGear |
|
5122 end |
|
5123 *) |
|
5124 end; |
|
5125 end; |
|
5126 |
|
5056 procedure doStepIceGun(Gear: PGear); |
5127 procedure doStepIceGun(Gear: PGear); |
5128 const iceWaitCollision:Longint = 0; |
|
5129 const iceCollideWithGround:Longint = 1; |
|
5130 //const iceWaitNextTarget:Longint = 2; |
|
5131 //const iceCollideWithHog:Longint = 4; |
|
5132 const iceCollideWithWater:Longint = 5; |
|
5133 //const waterFreezingTime:Longint = 500; |
|
5134 const groundFreezingTime:Longint = 1000; |
|
5135 const iceRadius = 32; |
|
5136 const iceHeight = 40; |
|
5057 var |
5137 var |
5058 HHGear: PGear; |
5138 HHGear: PGear; |
5139 landRect: TSDL_Rect; |
|
5059 ndX, ndY: hwFloat; |
5140 ndX, ndY: hwFloat; |
5060 i, t, gX, gY: LongInt; |
5141 i, t, gX, gY: LongInt; |
5061 hogs: PGearArrayS; |
5142 hogs: PGearArrayS; |
5062 len: Integer; |
5143 len: Integer; |
5063 begin |
5144 begin |
5064 HHGear := Gear^.Hedgehog^.Gear; |
5145 HHGear := Gear^.Hedgehog^.Gear; |
5065 if (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then |
5146 if (Gear^.Message and gmAttack <> 0) or (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then |
5066 begin |
5147 begin |
5067 DeleteGear(Gear); |
5148 DeleteGear(Gear); |
5068 AfterAttack; |
5149 AfterAttack; |
5069 exit |
5150 exit |
5070 end |
5151 end |
5071 else |
5152 else if Gear^.Message and (gmUp or gmDown) = 0 then updateFuel(Gear); |
5072 begin |
5153 |
5073 t:= Gear^.Health div 10; |
|
5074 if (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then |
|
5075 begin |
|
5076 Gear^.Damage:= t; |
|
5077 FreeTexture(Gear^.Tex); |
|
5078 Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(t) + |
|
5079 '%', cWhiteColor, fntSmall) |
|
5080 end |
|
5081 end; |
|
5082 if GameTicks mod 10 = 0 then dec(Gear^.Health); |
|
5083 with Gear^ do |
5154 with Gear^ do |
5084 begin |
5155 begin |
5085 HedgehogChAngle(HHGear); |
5156 HedgehogChAngle(HHGear); |
5086 ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; |
5157 ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; |
5087 ndY:= -AngleCos(HHGear^.Angle) * _4; |
5158 ndY:= -AngleCos(HHGear^.Angle) * _4; |
5088 if (ndX <> dX) or (ndY <> dY) or |
5159 if (ndX <> dX) or (ndY <> dY) or |
5089 ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and |
5160 ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and |
5090 (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0))) then |
5161 (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0))) then |
5091 begin |
5162 begin |
5092 dX:= ndX; |
5163 updateTarget(Gear, ndX, ndY); |
5093 dY:= ndY; |
5164 Timer := iceWaitCollision; |
5094 Pos:= 0; |
|
5095 Target.X:= NoPointX; |
|
5096 LastDamage:= nil; |
|
5097 X:= HHGear^.X; |
|
5098 Y:= HHGear^.Y; |
|
5099 (* unfreeze all semifrozen hogs - make this generic hog cleanup |
|
5100 iter := GearsList; |
|
5101 while iter <> nil do |
|
5102 begin |
|
5103 if (iter^.Kind = gtHedgehog) and |
|
5104 (iter^.Hedgehog^.Effects[heFrozen] < 0) then |
|
5105 iter^.Hedgehog^.Effects[heFrozen]:= 0; |
|
5106 iter:= iter^.NextGear |
|
5107 end *) |
|
5108 end |
5165 end |
5109 else |
5166 else |
5110 begin |
5167 begin |
5111 X:= X + dX; |
5168 X:= X + dX; |
5112 Y:= Y + dY; |
5169 Y:= Y + dY; |
5113 gX:= hwRound(X); |
5170 gX:= hwRound(X); |
5114 gY:= hwRound(Y); |
5171 gY:= hwRound(Y); |
5115 if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); |
5172 if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); |
5173 |
|
5116 if Target.X <> NoPointX then |
5174 if Target.X <> NoPointX then |
5117 begin |
5175 begin |
5176 CheckCollisionWithLand(Gear); |
|
5177 if (State and gstCollision) <> 0 then |
|
5178 begin |
|
5179 if Timer = iceWaitCollision then |
|
5180 begin |
|
5181 Timer := iceCollideWithGround; |
|
5182 Power := GameTicks; |
|
5183 end |
|
5184 end |
|
5185 else if (target.y >= cWaterLine) then |
|
5186 begin |
|
5187 if Timer = iceWaitCollision then |
|
5188 begin |
|
5189 Timer := iceCollideWithWater; |
|
5190 Power := GameTicks; |
|
5191 end; |
|
5192 end; |
|
5193 |
|
5118 if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then |
5194 if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then |
5119 begin |
5195 begin |
5120 X:= HHGear^.X; |
5196 X:= HHGear^.X; |
5121 Y:= HHGear^.Y |
5197 Y:= HHGear^.Y |
5122 end; |
5198 end; |
5199 |
|
5200 if (Timer = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then |
|
5201 begin |
|
5202 FillRoundInLand(target.x, target.y, iceRadius, icePixel); |
|
5203 landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1); |
|
5204 landRect.y := min(max(target.y - iceRadius, 0), LAND_HEIGHT - 1); |
|
5205 landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1); |
|
5206 landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1); |
|
5207 UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); |
|
5208 |
|
5209 // FillRoundInLandWithIce(Target.X, Target.Y, iceRadius); |
|
5210 SetAllHHToActive; |
|
5211 Timer := iceWaitCollision; |
|
5212 end; |
|
5213 |
|
5214 if (Timer = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime) then |
|
5215 begin |
|
5216 DrawIceBreak(Target.X, cWaterLine - iceHeight, iceRadius, iceHeight); |
|
5217 SetAllHHToActive; |
|
5218 Timer := iceWaitCollision; |
|
5219 end; |
|
5220 |
|
5123 // freeze nearby hogs |
5221 // freeze nearby hogs |
5124 if GameTicks mod 10 = 0 then dec(Gear^.Health); |
5222 hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2); |
5125 hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius); |
|
5126 if hogs.size > 0 then |
5223 if hogs.size > 0 then |
5127 for i:= 0 to hogs.size - 1 do |
5224 for i:= 0 to hogs.size - 1 do |
5128 if hogs.ar^[i] <> HHGear then |
5225 if hogs.ar^[i] <> HHGear then |
5129 begin |
5226 if GameTicks mod 5 = 0 then |
5130 //if Gear^.Hedgehog^.Effects[heFrozen]:= 0; |
5227 begin |
5131 end; |
5228 hogs.ar^[i]^.Active:= true; |
5229 if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] < 256 then |
|
5230 hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] := hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] + 1 |
|
5231 else if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] = 256 then |
|
5232 hogs.ar^[i]^.Hedgehog^.Effects[heFrozen]:= 200000;//cHedgehogTurnTime + cReadyDelay |
|
5233 end; |
|
5132 inc(Pos) |
5234 inc(Pos) |
5133 end |
5235 end |
5134 else if (t > 400) and ((gY > cWaterLine) or |
5236 else if (t > 400) and ((gY > cWaterLine) or |
5135 (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) |
5237 (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) |
5136 and (Land[gY, gX] <> 0))) then |
5238 and (Land[gY, gX] <> 0))) then |
5138 Target.X:= gX; |
5240 Target.X:= gX; |
5139 Target.Y:= gY; |
5241 Target.Y:= gY; |
5140 X:= HHGear^.X; |
5242 X:= HHGear^.X; |
5141 Y:= HHGear^.Y |
5243 Y:= HHGear^.Y |
5142 end; |
5244 end; |
5143 if (gX > max(LAND_WIDTH,4096)*2) or |
5245 {if (gX > max(LAND_WIDTH,4096)*2) or |
5144 (gX < -max(LAND_WIDTH,4096)) or |
5246 (gX < -max(LAND_WIDTH,4096)) or |
5145 (gY < -max(LAND_HEIGHT,4096)) or |
5247 (gY < -max(LAND_HEIGHT,4096)) or |
5146 (gY > max(LAND_HEIGHT,4096)+512) then |
5248 (gY > max(LAND_HEIGHT,4096)+512) then |
5147 begin |
5249 begin |
5148 X:= HHGear^.X; |
5250 X:= HHGear^.X; |
5149 Y:= HHGear^.Y |
5251 Y:= HHGear^.Y |
5150 end |
5252 end} |
5151 end |
5253 end |
5152 end; |
5254 end; |
5153 end; |
5255 end; |
5154 |
5256 |
5155 procedure doStepAddAmmo(Gear: PGear); |
5257 procedure doStepAddAmmo(Gear: PGear); |
5286 //var ox, oy: LongInt; |
5388 //var ox, oy: LongInt; |
5287 // la: hwFloat; |
5389 // la: hwFloat; |
5288 var a: real; |
5390 var a: real; |
5289 begin |
5391 begin |
5290 // Gear is shrunk so it can actually escape the hog without carving into the terrain |
5392 // Gear is shrunk so it can actually escape the hog without carving into the terrain |
5291 if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16; |
5393 if (Gear^.Radius = 4) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 7; |
5292 if Gear^.Damage > 100 then Gear^.CollisionMask:= 0 |
5394 if Gear^.Damage > 100 then Gear^.CollisionMask:= 0 |
5293 else if Gear^.Damage > 30 then |
5395 else if Gear^.Damage > 30 then |
5294 if GetRandom(max(4,18-Gear^.Damage div 10)) < 3 then Gear^.CollisionMask:= 0; |
5396 if GetRandom(max(4,18-Gear^.Damage div 10)) < 3 then Gear^.CollisionMask:= 0; |
5295 Gear^.Damage:= 0; |
5397 Gear^.Damage:= 0; |
5296 if Gear^.Timer > 0 then dec(Gear^.Timer); |
5398 if Gear^.Timer > 0 then dec(Gear^.Timer); |
5297 if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then |
5399 if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then |
5298 begin |
5400 begin |
5299 DeleteCI(Gear); |
5401 DeleteCI(Gear); |
5402 Gear^.Radius:= 7; |
|
5300 // used for damage and impact calc. needs balancing I think |
5403 // used for damage and impact calc. needs balancing I think |
5301 Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4)); |
5404 Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4)); |
5302 doStepFallingGear(Gear); |
5405 doStepFallingGear(Gear); |
5303 AllInactive := false; |
5406 AllInactive := false; |
5304 a:= Gear^.DirAngle; |
5407 a:= Gear^.DirAngle; |
5330 // else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent? |
5433 // else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent? |
5331 // AddFileLog('la: '+floattostr(la)+' DirAngle: '+inttostr(round(Gear^.DirAngle))); |
5434 // AddFileLog('la: '+floattostr(la)+' DirAngle: '+inttostr(round(Gear^.DirAngle))); |
5332 Gear^.dX:= _0; |
5435 Gear^.dX:= _0; |
5333 Gear^.dY:= _0; |
5436 Gear^.dY:= _0; |
5334 Gear^.State:= Gear^.State and (not gstMoving) or gstCollision; |
5437 Gear^.State:= Gear^.State and (not gstMoving) or gstCollision; |
5335 Gear^.Radius:= 20; |
5438 Gear^.Radius:= 16; |
5336 if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0); |
5439 if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0); |
5337 Gear^.Radius:= 16; |
|
5338 Gear^.Health:= 0; |
5440 Gear^.Health:= 0; |
5339 Gear^.Timer:= 500; |
5441 Gear^.Timer:= 500; |
5340 AddGearCI(Gear) |
5442 AddGearCI(Gear) |
5341 end |
5443 end |
5342 else if GameTicks and $3F = 0 then |
5444 else if GameTicks and $3F = 0 then |
5371 gx:= hwRound(Gear^.X); |
5473 gx:= hwRound(Gear^.X); |
5372 gy:= hwRound(Gear^.Y); |
5474 gy:= hwRound(Gear^.Y); |
5373 if Gear^.State and gstDrowning <> 0 then exit; |
5475 if Gear^.State and gstDrowning <> 0 then exit; |
5374 with Gear^ do |
5476 with Gear^ do |
5375 begin |
5477 begin |
5376 if CheckLandValue(gx, gy, $FF00) then |
5478 if CheckLandValue(gx, gy, lfLandMask) then |
5377 begin |
5479 begin |
5378 t:= Angle + hwRound((hwAbs(dX)+hwAbs(dY)) * _10); |
5480 t:= Angle + hwRound((hwAbs(dX)+hwAbs(dY)) * _10); |
5379 |
5481 |
5380 if t < 0 then inc(t, 4096) |
5482 if t < 0 then inc(t, 4096) |
5381 else if 4095 < t then dec(t, 4096); |
5483 else if 4095 < t then dec(t, 4096); |