2898 Gear^.DirAngle := DxDy2Angle(tdx, tdy); |
2898 Gear^.DirAngle := DxDy2Angle(tdx, tdy); |
2899 end; |
2899 end; |
2900 |
2900 |
2901 dec(Gear^.Health); |
2901 dec(Gear^.Health); |
2902 Gear^.Timer := Gear^.Health*10; |
2902 Gear^.Timer := Gear^.Health*10; |
2903 Gear^.PortalCounter:= 0; |
2903 if Gear^.Health mod 100 = 0 then Gear^.PortalCounter:= 0; |
2904 // This is not seconds, but at least it is *some* feedback |
2904 // This is not seconds, but at least it is *some* feedback |
2905 if (Gear^.Health = 0) or ((Gear^.Message and gmAttack) <> 0) then |
2905 if (Gear^.Health = 0) or ((Gear^.Message and gmAttack) <> 0) then |
2906 begin |
2906 begin |
2907 FollowGear := Gear; |
2907 FollowGear := Gear; |
2908 Gear^.RenderTimer := false; |
2908 Gear^.RenderTimer := false; |
3939 else |
3939 else |
3940 ny.isNegative := not ny.isNegative; |
3940 ny.isNegative := not ny.isNegative; |
3941 |
3941 |
3942 // inverse cake's normal movement direction, |
3942 // inverse cake's normal movement direction, |
3943 // as if it just walked through a hole |
3943 // as if it just walked through a hole |
3944 if iscake then |
3944 //if iscake then nspeed.isNegative:= not nspeed.isNegative; |
3945 nspeed.isNegative:= not nspeed.isNegative; |
|
3946 |
3945 |
3947 //AddFileLog('poffs:'+cstr(poffs)+' noffs:'+cstr(noffs)+' pspeed:'+cstr(pspeed)+' nspeed:'+cstr(nspeed)); |
3946 //AddFileLog('poffs:'+cstr(poffs)+' noffs:'+cstr(noffs)+' pspeed:'+cstr(pspeed)+' nspeed:'+cstr(nspeed)); |
3948 iterator^.dX := -pspeed * conPortal^.dX + nspeed * nx; |
3947 iterator^.dX := -pspeed * conPortal^.dX + nspeed * nx; |
3949 iterator^.dY := -pspeed * conPortal^.dY + nspeed * ny; |
3948 iterator^.dY := -pspeed * conPortal^.dY + nspeed * ny; |
3950 |
3949 |
3991 |
3990 |
3992 if iterator^.Radius > 1 then |
3991 if iterator^.Radius > 1 then |
3993 iterator^.Radius := iterator^.Radius - 1; |
3992 iterator^.Radius := iterator^.Radius - 1; |
3994 |
3993 |
3995 // check front |
3994 // check front |
3996 isCollision := TestCollisionYwithGear(iterator, sy) |
3995 isCollision := TestCollisionY(iterator, sy) |
3997 or TestCollisionXwithGear(iterator, sx); |
3996 or TestCollisionX(iterator, sx); |
3998 |
3997 |
3999 if not isCollision then |
3998 if not isCollision then |
4000 begin |
3999 begin |
4001 // check center area (with half the radius so that the |
4000 // check center area (with half the radius so that the |
4002 // the square check won't check more pixels than we want to) |
4001 // the square check won't check more pixels than we want to) |
4003 iterator^.Radius := 1 + resetr div 2; |
4002 iterator^.Radius := 1 + resetr div 2; |
4004 rh := resetr div 4; |
4003 rh := resetr div 4; |
4005 isCollision := TestCollisionYwithXYShift(iterator, 0, -sy * rh, sy) |
4004 isCollision := TestCollisionYwithXYShift(iterator, 0, -sy * rh, sy, false) |
4006 or TestCollisionXwithXYShift(iterator, ox * rh, 0, sx); |
4005 or TestCollisionXwithXYShift(iterator, ox * rh, 0, sx, false); |
4007 end; |
4006 end; |
4008 |
4007 |
4009 iterator^.Radius := resetr; |
4008 iterator^.Radius := resetr; |
4010 |
4009 |
4011 if isCollision then |
4010 if isCollision then |
4022 // |
4021 // |
4023 // You're now officially portaled! |
4022 // You're now officially portaled! |
4024 // |
4023 // |
4025 |
4024 |
4026 // Until loops are reliably broken |
4025 // Until loops are reliably broken |
4027 inc(iterator^.PortalCounter); |
4026 if iscake then iterator^.PortalCounter:= 33 |
|
4027 else inc(iterator^.PortalCounter); |
4028 |
4028 |
4029 if not isbullet and (iterator^.Kind <> gtFlake) then |
4029 if not isbullet and (iterator^.Kind <> gtFlake) then |
4030 FollowGear := iterator; |
4030 FollowGear := iterator; |
4031 |
4031 |
4032 // This jiggles gears, to ensure a portal connection just placed under a gear takes effect. |
4032 // This jiggles gears, to ensure a portal connection just placed under a gear takes effect. |