69 procedure doStepBulletHit(Gear: PVisualGear; Steps: Longword); |
69 procedure doStepBulletHit(Gear: PVisualGear; Steps: Longword); |
70 procedure doStepCircle(Gear: PVisualGear; Steps: Longword); |
70 procedure doStepCircle(Gear: PVisualGear; Steps: Longword); |
71 procedure doStepSmoothWindBar(Gear: PVisualGear; Steps: Longword); |
71 procedure doStepSmoothWindBar(Gear: PVisualGear; Steps: Longword); |
72 procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword); |
72 procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword); |
73 |
73 |
|
74 function isSorterActive: boolean; inline; |
74 procedure initModule; |
75 procedure initModule; |
75 |
76 |
76 implementation |
77 implementation |
77 uses uVariables, Math, uConsts, uVisualGearsList, uFloat, uSound, uRenderUtils, uWorld; |
78 uses uVariables, Math, uConsts, uVisualGearsList, uFloat, uSound, uRenderUtils, uWorld; |
78 |
79 |
479 var thexchar: array[0..cMaxTeams] of |
480 var thexchar: array[0..cMaxTeams] of |
480 record |
481 record |
481 dy, ny, dw: LongInt; |
482 dy, ny, dw: LongInt; |
482 team: PTeam; |
483 team: PTeam; |
483 SortFactor: QWord; |
484 SortFactor: QWord; |
|
485 hdw: array[0..cMaxHHIndex] of LongInt; |
484 end; |
486 end; |
485 currsorter: PVisualGear = nil; |
487 currsorter: PVisualGear = nil; |
486 |
488 |
|
489 function isSorterActive: boolean; inline; |
|
490 begin |
|
491 isSorterActive:= currsorter <> nil |
|
492 end; |
|
493 |
487 procedure doStepTeamHealthSorterWork(Gear: PVisualGear; Steps: Longword); |
494 procedure doStepTeamHealthSorterWork(Gear: PVisualGear; Steps: Longword); |
488 var i, t: LongInt; |
495 var i, t, h: LongInt; |
489 begin |
496 begin |
490 for t:= 1 to min(Steps, Gear^.Timer) do |
497 for t:= 1 to min(Steps, Gear^.Timer) do |
491 begin |
498 begin |
492 dec(Gear^.Timer); |
499 dec(Gear^.Timer); |
493 if (Gear^.Timer and 15) = 0 then |
500 if (Gear^.Timer and 15) = 0 then |
494 for i:= 0 to Pred(TeamsCount) do |
501 for i:= 0 to Pred(TeamsCount) do |
495 with thexchar[i] do |
502 with thexchar[i] do |
496 begin |
503 begin |
497 {$WARNINGS OFF} |
504 {$WARNINGS OFF} |
498 team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer) div cSorterWorkTime; |
505 team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer) div cSorterWorkTime; |
499 team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * LongInt(Gear^.Timer) div cSorterWorkTime; |
506 team^.TeamHealthBarHealth:= team^.TeamHealth + dw * LongInt(Gear^.Timer) div cSorterWorkTime; |
|
507 |
|
508 for h:= 0 to cMaxHHIndex do |
|
509 if (team^.Hedgehogs[h].Gear <> nil) then |
|
510 team^.Hedgehogs[h].HealthBarHealth:= team^.Hedgehogs[h].Gear^.Health + hdw[h] * LongInt(Gear^.Timer) div cSorterWorkTime |
|
511 else |
|
512 team^.Hedgehogs[h].HealthBarHealth:= hdw[h] * LongInt(Gear^.Timer) div cSorterWorkTime; |
500 {$WARNINGS ON} |
513 {$WARNINGS ON} |
501 end; |
514 end; |
502 end; |
515 end; |
503 |
516 |
504 if (Gear^.Timer = 0) or (currsorter <> Gear) then |
517 if (Gear^.Timer = 0) or (currsorter <> Gear) then |
511 end; |
524 end; |
512 |
525 |
513 procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword); |
526 procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword); |
514 var i: Longword; |
527 var i: Longword; |
515 b: boolean; |
528 b: boolean; |
516 t: LongInt; |
529 t, h: LongInt; |
517 begin |
530 begin |
518 Steps:= Steps; // avoid compiler hint |
531 Steps:= Steps; // avoid compiler hint |
519 |
532 |
520 for t:= 0 to Pred(TeamsCount) do |
533 for t:= 0 to Pred(TeamsCount) do |
521 with thexchar[t] do |
534 with thexchar[t] do |
522 begin |
535 begin |
523 team:= TeamsArray[t]; |
536 team:= TeamsArray[t]; |
524 dy:= team^.DrawHealthY; |
537 dy:= team^.DrawHealthY; |
525 dw:= team^.TeamHealthBarWidth - team^.NewTeamHealthBarWidth; |
538 dw:= team^.TeamHealthBarHealth - team^.TeamHealth; |
526 if team^.TeamHealth > 0 then |
539 if team^.TeamHealth > 0 then |
527 begin |
540 begin |
528 SortFactor:= team^.Clan^.ClanHealth; |
541 SortFactor:= team^.Clan^.ClanHealth; |
529 SortFactor:= (SortFactor shl 3) + team^.Clan^.ClanIndex; |
542 SortFactor:= (SortFactor shl 3) + team^.Clan^.ClanIndex; |
530 SortFactor:= (SortFactor shl 30) + team^.TeamHealth; |
543 SortFactor:= (SortFactor shl 30) + team^.TeamHealth; |
531 end |
544 end |
532 else |
545 else |
533 SortFactor:= 0; |
546 SortFactor:= 0; |
|
547 |
|
548 for h:= 0 to cMaxHHIndex do |
|
549 if (team^.Hedgehogs[h].Gear <> nil) then |
|
550 hdw[h]:= team^.Hedgehogs[h].HealthBarHealth - team^.Hedgehogs[h].Gear^.Health |
|
551 else |
|
552 hdw[h]:= team^.Hedgehogs[h].HealthBarHealth; |
534 end; |
553 end; |
535 |
554 |
536 if TeamsCount > 1 then |
555 if TeamsCount > 1 then |
537 repeat |
556 repeat |
538 b:= true; |
557 b:= true; |