changeset 814 | 7fb4417b7bc1 |
parent 809 | b33c2def1576 |
child 815 | 82ff416301bd |
813:36fffe78ff11 | 814:7fb4417b7bc1 |
---|---|
67 GearsList: PGear = nil; |
67 GearsList: PGear = nil; |
68 KilledHHs: Longword = 0; |
68 KilledHHs: Longword = 0; |
69 |
69 |
70 implementation |
70 implementation |
71 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, |
71 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, |
72 uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, GL; |
72 uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, GL, |
73 uStats; |
|
73 |
74 |
74 const MAXROPEPOINTS = 300; |
75 const MAXROPEPOINTS = 300; |
75 var RopePoints: record |
76 var RopePoints: record |
76 Count: Longword; |
77 Count: Longword; |
77 HookAngle: GLfloat; |
78 HookAngle: GLfloat; |
79 X, Y: hwFloat; |
80 X, Y: hwFloat; |
80 dLen: hwFloat; |
81 dLen: hwFloat; |
81 b: boolean; |
82 b: boolean; |
82 end; |
83 end; |
83 end; |
84 end; |
84 StepDamage: Longword = 0; |
|
85 |
85 |
86 procedure DeleteGear(Gear: PGear); forward; |
86 procedure DeleteGear(Gear: PGear); forward; |
87 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward; |
87 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward; |
88 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
88 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
89 procedure AmmoFlameWork(Ammo: PGear); forward; |
89 procedure AmmoFlameWork(Ammo: PGear); forward; |
326 begin |
326 begin |
327 if not (hwRound(Gear^.Y) < cWaterLine) then |
327 if not (hwRound(Gear^.Y) < cWaterLine) then |
328 begin |
328 begin |
329 t:= max(Gear^.Damage, Gear^.Health); |
329 t:= max(Gear^.Damage, Gear^.Health); |
330 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
330 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
331 inc(StepDamage, t) |
331 uStats.HedgehogDamaged(Gear, t) |
332 end; |
332 end; |
333 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
333 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
334 if CurrentHedgehog^.Gear = Gear then |
334 if CurrentHedgehog^.Gear = Gear then |
335 FreeActionsList; // to avoid ThinkThread on drawned gear |
335 FreeActionsList; // to avoid ThinkThread on drawned gear |
336 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
336 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
354 begin |
354 begin |
355 if Gear^.Kind = gtHedgehog then |
355 if Gear^.Kind = gtHedgehog then |
356 if Gear^.Damage <> 0 then |
356 if Gear^.Damage <> 0 then |
357 begin |
357 begin |
358 CheckNoDamage:= false; |
358 CheckNoDamage:= false; |
359 inc(StepDamage, Gear^.Damage); |
|
360 if Gear^.Health < Gear^.Damage then Gear^.Health:= 0 |
359 if Gear^.Health < Gear^.Damage then Gear^.Health:= 0 |
361 else dec(Gear^.Health, Gear^.Damage); |
360 else dec(Gear^.Health, Gear^.Damage); |
362 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) - cHHRadius - 12, |
361 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) - cHHRadius - 12, |
363 gtHealthTag, Gear^.Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
362 gtHealthTag, Gear^.Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
364 RenderHealth(PHedgehog(Gear^.Hedgehog)^); |
363 RenderHealth(PHedgehog(Gear^.Hedgehog)^); |
376 AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
375 AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
377 end; |
376 end; |
378 |
377 |
379 procedure ProcessGears; |
378 procedure ProcessGears; |
380 const delay: LongWord = 0; |
379 const delay: LongWord = 0; |
381 step: (stDelay, stChDmg, stChWin, stSpawn, stNTurn) = stDelay; |
380 step: (stDelay, stChDmg, stChWin, stTurnReact, stSpawn, stNTurn) = stDelay; |
382 var Gear, t: PGear; |
381 var Gear, t: PGear; |
383 begin |
382 begin |
384 AllInactive:= true; |
383 AllInactive:= true; |
385 t:= GearsList; |
384 t:= GearsList; |
386 while t<>nil do |
385 while t<>nil do |
401 if delay = 0 then |
400 if delay = 0 then |
402 inc(step) |
401 inc(step) |
403 end; |
402 end; |
404 stChDmg: if CheckNoDamage then inc(step) else step:= stDelay; |
403 stChDmg: if CheckNoDamage then inc(step) else step:= stDelay; |
405 stChWin: if not CheckForWin then inc(step) else step:= stDelay; |
404 stChWin: if not CheckForWin then inc(step) else step:= stDelay; |
405 stTurnReact: begin |
|
406 TurnReaction; |
|
407 inc(step) |
|
408 end; |
|
406 stSpawn: begin |
409 stSpawn: begin |
407 if not isInMultiShoot then SpawnBoxOfSmth; |
410 if not isInMultiShoot then SpawnBoxOfSmth; |
408 inc(step) |
411 inc(step) |
409 end; |
412 end; |
410 stNTurn: begin |
413 stNTurn: begin |
411 //AwareOfExplosion(0, 0, 0); |
414 //AwareOfExplosion(0, 0, 0); |
412 if isInMultiShoot then isInMultiShoot:= false |
415 if isInMultiShoot then isInMultiShoot:= false |
413 else begin |
416 else begin |
414 with CurrentHedgehog^ do |
|
415 if MaxStepDamage < StepDamage then MaxStepDamage:= StepDamage; |
|
416 StepDamage:= 0; |
|
417 ParseCommand('/nextturn', true); |
417 ParseCommand('/nextturn', true); |
418 end; |
418 end; |
419 step:= Low(step) |
419 step:= Low(step) |
420 end; |
420 end; |
421 end; |
421 end; |
681 gtFlame: begin |
681 gtFlame: begin |
682 {$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
682 {$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
683 if (Mask and EXPLNoDamage) = 0 then |
683 if (Mask and EXPLNoDamage) = 0 then |
684 begin |
684 begin |
685 inc(Gear^.Damage, dmg); |
685 inc(Gear^.Damage, dmg); |
686 uStats.HedgehogDamaged(Gear, dmg); |
|
686 if Gear^.Kind = gtHedgehog then |
687 if Gear^.Kind = gtHedgehog then |
687 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, Gear) |
688 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, Gear) |
688 end; |
689 end; |
689 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
690 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
690 begin |
691 begin |
710 end; |
711 end; |
711 |
712 |
712 procedure ShotgunShot(Gear: PGear); |
713 procedure ShotgunShot(Gear: PGear); |
713 var t: PGear; |
714 var t: PGear; |
714 dmg: integer; |
715 dmg: integer; |
715 hh: PHedgehog; |
|
716 begin |
716 begin |
717 Gear^.Radius:= cShotgunRadius; |
717 Gear^.Radius:= cShotgunRadius; |
718 hh:= Gear^.Hedgehog; |
|
719 t:= GearsList; |
718 t:= GearsList; |
720 while t <> nil do |
719 while t <> nil do |
721 begin |
720 begin |
722 dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25); |
721 dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25); |
723 if dmg > 0 then |
722 if dmg > 0 then |
728 gtTarget: begin |
727 gtTarget: begin |
729 inc(t^.Damage, dmg); |
728 inc(t^.Damage, dmg); |
730 if t^.Kind = gtHedgehog then |
729 if t^.Kind = gtHedgehog then |
731 begin |
730 begin |
732 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, t); |
731 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, t); |
733 inc(hh^.DamageGiven, dmg) |
732 uStats.HedgehogDamaged(Gear, dmg) |
734 end; |
733 end; |
735 DeleteCI(t); |
734 DeleteCI(t); |
736 t^.dX:= t^.dX + SignAs(Gear^.dX * dmg * _0_01 + cHHKick, t^.X - Gear^.X); |
735 t^.dX:= t^.dX + SignAs(Gear^.dX * dmg * _0_01 + cHHKick, t^.X - Gear^.X); |
737 t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
736 t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
738 t^.State:= t^.State or gstMoving; |
737 t^.State:= t^.State or gstMoving; |
768 gtCase: begin |
767 gtCase: begin |
769 inc(t^.ar[i]^.Damage, Damage); |
768 inc(t^.ar[i]^.Damage, Damage); |
770 if t^.ar[i]^.Kind = gtHedgehog then |
769 if t^.ar[i]^.Kind = gtHedgehog then |
771 begin |
770 begin |
772 AddDamageTag(hwRound(t^.ar[i]^.X), hwRound(t^.ar[i]^.Y), Damage, t^.ar[i]); |
771 AddDamageTag(hwRound(t^.ar[i]^.X), hwRound(t^.ar[i]^.Y), Damage, t^.ar[i]); |
773 inc(hh^.DamageGiven, Damage) |
772 uStats.HedgehogDamaged(t^.ar[i], Damage) |
774 end; |
773 end; |
775 DeleteCI(t^.ar[i]); |
774 DeleteCI(t^.ar[i]); |
776 t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01; |
775 t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01; |
777 t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01; |
776 t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01; |
778 t^.ar[i]^.Active:= true; |
777 t^.ar[i]^.Active:= true; |