equal
deleted
inserted
replaced
25 |
25 |
26 function cakeStep(Gear: PGear): boolean; |
26 function cakeStep(Gear: PGear): boolean; |
27 |
27 |
28 implementation |
28 implementation |
29 |
29 |
30 uses SDLh, uFloat, uCollisions; |
30 uses SDLh, uFloat, uCollisions, uVariables, uGearsUtils; |
31 |
31 |
32 |
32 |
33 |
33 |
34 const dirs: array[0..3] of TPoint = ((x: 0; y: -1), |
34 const dirs: array[0..3] of TPoint = ((x: 0; y: -1), |
35 (x: 1; y: 0), |
35 (x: 1; y: 0), |
93 Gear^.Y := Gear^.Y + int2hwFloat(yyn); |
93 Gear^.Y := Gear^.Y + int2hwFloat(yyn); |
94 NextAngle(Gear, dA) |
94 NextAngle(Gear, dA) |
95 end |
95 end |
96 end; |
96 end; |
97 |
97 |
|
98 // Handle world wrap and bounce edge manually |
|
99 if (WorldEdge = weWrap) and |
|
100 ((hwRound(Gear^.X) < leftX) or (hwRound(Gear^.X) > rightX)) then |
|
101 begin |
|
102 LeftImpactTimer:= 150; |
|
103 RightImpactTimer:= 150; |
|
104 Gear^.WDTimer:= 0; |
|
105 Gear^.Karma:= 1; |
|
106 end |
|
107 else if (WorldEdge = weBounce) and |
|
108 (((hwRound(Gear^.X) - Gear^.Radius) < leftX) or ((hwRound(Gear^.X) + Gear^.Radius) > rightX)) then |
|
109 begin |
|
110 if (hwRound(Gear^.X) - Gear^.Radius < leftX) then |
|
111 LeftImpactTimer:= 333 |
|
112 else |
|
113 RightImpactTimer:= 333; |
|
114 Gear^.Karma:= 2; |
|
115 Gear^.WDTimer:= 0; |
|
116 if (Gear^.Radius > 2) and (Gear^.dX.QWordValue > _0_001.QWordValue) then |
|
117 AddBounceEffectForGear(Gear); |
|
118 end; |
|
119 |
98 cakeStep:= Gear^.WDTimer < 4 |
120 cakeStep:= Gear^.WDTimer < 4 |
99 end; |
121 end; |
100 |
122 |
101 end. |
123 end. |