equal
deleted
inserted
replaced
73 var Count: Longword; |
73 var Count: Longword; |
74 cinfos: array[0..MAXRECTSINDEX] of TCollisionEntry; |
74 cinfos: array[0..MAXRECTSINDEX] of TCollisionEntry; |
75 ga: TGearArray; |
75 ga: TGearArray; |
76 |
76 |
77 procedure AddCI(Gear: PGear); |
77 procedure AddCI(Gear: PGear); |
78 var t: PGear; |
78 begin |
79 begin |
79 if (Gear^.CollisionIndex >= 0) or |
80 if Gear^.CollisionIndex >= 0 then |
80 ((Count > MAXRECTSINDEX-200) and ((Gear^.Kind = gtMine) or (Gear^.Kind = gtSMine) or (Gear^.Kind = gtKnife))) then |
81 exit; |
81 exit; |
82 TryDo(Count <= MAXRECTSINDEX, 'Collision rects array overflow', true); |
82 TryDo(Count <= MAXRECTSINDEX, 'Collision rects array overflow', true); |
83 with cinfos[Count] do |
83 with cinfos[Count] do |
84 begin |
84 begin |
85 X:= hwRound(Gear^.X); |
85 X:= hwRound(Gear^.X); |
88 ChangeRoundInLand(X, Y, Radius - 1, true, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen = 0))); |
88 ChangeRoundInLand(X, Y, Radius - 1, true, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen = 0))); |
89 cGear:= Gear |
89 cGear:= Gear |
90 end; |
90 end; |
91 Gear^.CollisionIndex:= Count; |
91 Gear^.CollisionIndex:= Count; |
92 inc(Count); |
92 inc(Count); |
93 // mines are the easiest way to overflow collision |
|
94 if (Count > (MAXRECTSINDEX-20)) then |
|
95 begin |
|
96 t:= GearsList; |
|
97 while (t <> nil) and (t^.Kind <> gtMine) do |
|
98 t:= t^.NextGear; |
|
99 if (t <> nil) then |
|
100 t^.State:= t^.State or gmDelete |
|
101 end; |
|
102 end; |
93 end; |
103 |
94 |
104 procedure DeleteCI(Gear: PGear); |
95 procedure DeleteCI(Gear: PGear); |
105 begin |
96 begin |
106 if Gear^.CollisionIndex >= 0 then |
97 if Gear^.CollisionIndex >= 0 then |