85 end; |
85 end; |
86 DeleteGear(Gear) |
86 DeleteGear(Gear) |
87 end; |
87 end; |
88 |
88 |
89 procedure RopeWaitCollision(Gear, HHGear: PGear); |
89 procedure RopeWaitCollision(Gear, HHGear: PGear); |
|
90 var i: LongInt; |
|
91 stuck: Boolean; |
90 begin |
92 begin |
91 PlaySound(sndRopeRelease); |
93 PlaySound(sndRopeRelease); |
92 with HHGear^ do |
94 with HHGear^ do |
93 begin |
95 begin |
94 Message := Message and (not gmAttack); |
96 Message := Message and (not gmAttack); |
95 State := State or gstMoving; |
97 State := State or gstMoving; |
|
98 end; |
|
99 if (TestCollisionYwithGear(HHGear, 1) <> 0) and (TestCollisionYwithGear(HHGear, -1) = 0) then |
|
100 begin |
|
101 i:= 1; |
|
102 repeat |
|
103 begin |
|
104 inc(i); |
|
105 stuck:= TestCollisionYwithGear(HHGear, i) <> 0 |
|
106 end |
|
107 until (i = 8) or not stuck; |
|
108 HHGear^.Y:= HHGear^.Y-int2hwFloat(pred(i)) |
96 end; |
109 end; |
97 RopePoints.Count := 0; |
110 RopePoints.Count := 0; |
98 Gear^.Elasticity := _0; |
111 Gear^.Elasticity := _0; |
99 Gear^.doStep := @doStepRopeAfterAttack; |
112 Gear^.doStep := @doStepRopeAfterAttack; |
100 HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue div Gear^.stepFreq; |
113 HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue div Gear^.stepFreq; |
166 if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx)) |
179 if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx)) |
167 or (TestCollisionYwithGear(HHGear, -hwSign(ropeDy)) <> 0)) then |
180 or (TestCollisionYwithGear(HHGear, -hwSign(ropeDy)) <> 0)) then |
168 Gear^.Elasticity := Gear^.Elasticity - _2_4 |
181 Gear^.Elasticity := Gear^.Elasticity - _2_4 |
169 else haveCollision:= true; |
182 else haveCollision:= true; |
170 |
183 |
|
184 (* |
|
185 I am not so sure this is useful. Disabling |
171 if haveCollision then |
186 if haveCollision then |
172 begin |
187 begin |
173 if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) and not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
188 if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) and not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
174 HHGear^.dX.isNegative:= not HHGear^.dX.isNegative; |
189 HHGear^.dX.isNegative:= not HHGear^.dX.isNegative; |
175 if (TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) <> 0) and (TestCollisionYwithGear(HHGear, -hwSign(HHGear^.dY)) = 0) then |
190 if (TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) <> 0) and (TestCollisionYwithGear(HHGear, -hwSign(HHGear^.dY)) = 0) then |
176 HHGear^.dY.isNegative:= not HHGear^.dY.isNegative; |
191 HHGear^.dY.isNegative:= not HHGear^.dY.isNegative; |
177 end; |
192 end; |
|
193 *) |
178 |
194 |
179 mdX := ropeDx + HHGear^.dX; |
195 mdX := ropeDx + HHGear^.dX; |
180 mdY := ropeDy + HHGear^.dY; |
196 mdY := ropeDy + HHGear^.dY; |
181 len := _1 / Distance(mdX, mdY); |
197 len := _1 / Distance(mdX, mdY); |
182 // rope vector plus hedgehog direction vector normalized |
198 // rope vector plus hedgehog direction vector normalized |