equal
deleted
inserted
replaced
45 t:= GearsList; |
45 t:= GearsList; |
46 b:= false; |
46 b:= false; |
47 cnt:= 0; |
47 cnt:= 0; |
48 while (t <> nil) do |
48 while (t <> nil) do |
49 begin |
49 begin |
50 if (t <> Gear) then |
50 if (t <> Gear) and not (t.Kind in [gtGrave, gtMine]) then |
51 if (x < t.X + t.HalfWidth ) and (t.X - t.HalfWidth < xw) and |
51 if (x < t.X + t.HalfWidth ) and (t.X - t.HalfWidth < xw) and |
52 (y < t.Y + t.HalfHeight) and (t.Y - t.HalfHeight < yh) then |
52 (y < t.Y + t.HalfHeight) and (t.Y - t.HalfHeight < yh) then |
53 if t.Kind = gtHedgehog then |
53 if t.Kind = gtHedgehog then |
54 begin |
54 begin |
55 ar[cnt]:= t; |
55 ar[cnt]:= t; |
56 inc(cnt) |
56 inc(cnt) |
57 end else |
57 end else b:= true; |
58 if not (t.Kind in [gtGrave, gtMine]) then b:= true; |
|
59 t:= t.NextGear |
58 t:= t.NextGear |
60 end; |
59 end; |
61 ar[cnt]:= Gear; |
60 ar[cnt]:= Gear; |
62 inc(cnt); |
61 inc(cnt); |
63 if b then |
62 if b then |
169 end; |
168 end; |
170 AttackBar:= 0 |
169 AttackBar:= 0 |
171 end |
170 end |
172 end; |
171 end; |
173 |
172 |
174 |
173 //////////////////////////////////////////////////////////////////////////////// |
|
174 procedure PickUp(HH, Gear: PGear); |
|
175 begin |
|
176 case Gear.Pos of |
|
177 posCaseHealth: begin |
|
178 inc(HH.Health, Gear.Health); |
|
179 RenderHealth(PHedgehog(HH.Hedgehog)^) |
|
180 end; |
|
181 end; |
|
182 end; |
175 |
183 |
176 procedure doStepHedgehog(Gear: PGear); forward; |
184 procedure doStepHedgehog(Gear: PGear); forward; |
177 //////////////////////////////////////////////////////////////////////////////// |
185 //////////////////////////////////////////////////////////////////////////////// |
178 procedure doStepHedgehogDriven(Gear: PGear); |
186 procedure doStepHedgehogDriven(Gear: PGear); |
179 const StepTicks: LongWord = 0; |
187 const StepTicks: LongWord = 0; |
|
188 cStepTicks = 38; |
180 var t: PGear; |
189 var t: PGear; |
181 begin |
190 begin |
182 if isinMultiShoot and (Gear.Damage = 0) then |
191 if isinMultiShoot and (Gear.Damage = 0) then |
183 begin |
192 begin |
184 if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear); |
193 if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear); |
192 Gear.State:= Gear.State and not gstHHDriven; |
201 Gear.State:= Gear.State and not gstHHDriven; |
193 if Gear.Damage > 0 then |
202 if Gear.Damage > 0 then |
194 Gear.State:= Gear.State and not gstHHJumping; |
203 Gear.State:= Gear.State and not gstHHJumping; |
195 exit |
204 exit |
196 end; |
205 end; |
197 |
206 if ((Gear.State and gstFalling) <> 0) or (StepTicks = cStepTicks) |
198 // check for case with ammo |
207 or (CurAmmoGear <> nil) then // we're moving |
199 t:= CheckGearNear(Gear, gtCase, 30, 30); |
208 begin |
200 if t <> nil then |
209 // check for case with ammo |
201 begin |
210 t:= CheckGearNear(Gear, gtCase, 36, 36); |
202 t.Message:= gm_Destroy; |
211 if t <> nil then |
203 ; // take ammo from it |
212 begin |
|
213 t.Message:= gm_Destroy; |
|
214 PickUp(Gear, t) |
|
215 end; |
204 end; |
216 end; |
205 |
217 |
206 if CurAmmoGear <> nil then |
218 if CurAmmoGear <> nil then |
207 begin |
219 begin |
208 CurAmmoGear.Message:= Gear.Message; |
220 CurAmmoGear.Message:= Gear.Message; |
304 end; |
316 end; |
305 end; |
317 end; |
306 if (Gear.Message and gm_Left )<>0 then Gear.dX:= -1.0 else |
318 if (Gear.Message and gm_Left )<>0 then Gear.dX:= -1.0 else |
307 if (Gear.Message and gm_Right )<>0 then Gear.dX:= 1.0 else exit; |
319 if (Gear.Message and gm_Right )<>0 then Gear.dX:= 1.0 else exit; |
308 PHedgehog(Gear.Hedgehog).visStepPos:= (PHedgehog(Gear.Hedgehog).visStepPos + 1) and 7; |
320 PHedgehog(Gear.Hedgehog).visStepPos:= (PHedgehog(Gear.Hedgehog).visStepPos + 1) and 7; |
309 StepTicks:= 40; |
321 StepTicks:= cStepTicks; |
310 RemoveIntersectorsCR(Gear); |
322 RemoveIntersectorsCR(Gear); |
311 if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then |
323 if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then |
312 begin |
324 begin |
313 if not (TestCollisionXwithXYShift(Gear, 0, -6, Sign(Gear.dX)) |
325 if not (TestCollisionXwithXYShift(Gear, 0, -6, Sign(Gear.dX)) |
314 or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
326 or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |