439 ScriptCall('onGearAdd', gear^.uid); |
439 ScriptCall('onGearAdd', gear^.uid); |
440 end; |
440 end; |
441 |
441 |
442 procedure DeleteGear(Gear: PGear); |
442 procedure DeleteGear(Gear: PGear); |
443 var team: PTeam; |
443 var team: PTeam; |
444 t,i: Longword; |
444 t,i: Longword; |
445 k: boolean; |
445 k: boolean; |
446 begin |
446 begin |
447 |
447 |
448 ScriptCall('onGearDelete', gear^.uid); |
448 ScriptCall('onGearDelete', gear^.uid); |
449 |
449 |
450 DeleteCI(Gear); |
450 DeleteCI(Gear); |
451 |
451 |
452 if Gear^.Tex <> nil then |
452 if Gear^.Tex <> nil then |
453 begin |
453 begin |
454 FreeTexture(Gear^.Tex); |
454 FreeTexture(Gear^.Tex); |
455 Gear^.Tex:= nil |
455 Gear^.Tex:= nil |
456 end; |
456 end; |
457 |
457 |
458 if Gear^.Kind = gtHedgehog then |
458 if Gear^.Kind = gtHedgehog then |
459 if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then |
459 if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then |
460 begin |
460 begin |
461 Gear^.Message:= gm_Destroy; |
461 Gear^.Message:= gm_Destroy; |
462 CurAmmoGear^.Message:= gm_Destroy; |
462 CurAmmoGear^.Message:= gm_Destroy; |
463 exit |
463 exit |
464 end |
464 end |
465 else |
465 else |
466 begin |
466 begin |
467 if (hwRound(Gear^.Y) >= cWaterLine) then |
467 if (hwRound(Gear^.Y) >= cWaterLine) then |
468 begin |
468 begin |
469 t:= max(Gear^.Damage, Gear^.Health); |
469 t:= max(Gear^.Damage, Gear^.Health); |
470 Gear^.Damage:= t; |
470 Gear^.Damage:= t; |
471 if cWaterOpacity < $FF then |
471 if cWaterOpacity < $FF then |
472 AddGear(hwRound(Gear^.X), min(hwRound(Gear^.Y),cWaterLine+cVisibleWater+32), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
472 AddGear(hwRound(Gear^.X), min(hwRound(Gear^.Y),cWaterLine+cVisibleWater+32), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
473 uStats.HedgehogDamaged(Gear) |
473 uStats.HedgehogDamaged(Gear) |
474 end; |
474 end; |
475 |
475 |
476 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
476 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
477 if CurrentHedgehog^.Gear = Gear then |
477 if CurrentHedgehog^.Gear = Gear then |
478 FreeActionsList; // to avoid ThinkThread on drawned gear |
478 FreeActionsList; // to avoid ThinkThread on drawned gear |
479 |
479 |
480 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
480 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
481 if PHedgehog(Gear^.Hedgehog)^.King then |
481 if PHedgehog(Gear^.Hedgehog)^.King then |
482 begin |
482 begin |
483 // are there any other kings left? Just doing nil check. Presumably a mortally wounded king will get reaped soon enough |
483 // are there any other kings left? Just doing nil check. Presumably a mortally wounded king will get reaped soon enough |
484 k:= false; |
484 k:= false; |
485 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
485 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
486 if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then k:= true; |
486 if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then k:= true; |
487 if not k then |
487 if not k then |
488 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
488 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
489 TeamGoneEffect(team^.Clan^.Teams[i]^) |
489 TeamGoneEffect(team^.Clan^.Teams[i]^) |
490 end; |
490 end; |
491 inc(KilledHHs); |
491 inc(KilledHHs); |
492 RecountTeamHealth(team) |
492 RecountTeamHealth(team) |
493 end; |
493 end; |
494 {$IFDEF DEBUGFILE} |
494 {$IFDEF DEBUGFILE} |
495 with Gear^ do AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind))); |
495 with Gear^ do AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind))); |
496 {$ENDIF} |
496 {$ENDIF} |
497 |
497 |
498 if Gear^.TriggerId <> 0 then TickTrigger(Gear^.TriggerId); |
498 if Gear^.TriggerId <> 0 then TickTrigger(Gear^.TriggerId); |
552 flag: Boolean; |
552 flag: Boolean; |
553 begin |
553 begin |
554 Gear:= GearsList; |
554 Gear:= GearsList; |
555 |
555 |
556 while Gear <> nil do |
556 while Gear <> nil do |
557 begin |
557 begin |
558 if Gear^.Kind = gtHedgehog then |
558 if Gear^.Kind = gtHedgehog then |
559 begin |
559 begin |
560 inc(Gear^.Damage, min(cHealthDecrease, max(0,Gear^.Health - 1 - Gear^.Damage))); |
560 inc(Gear^.Damage, min(cHealthDecrease, max(0,Gear^.Health - 1 - Gear^.Damage))); |
561 if PHedgehog(Gear^.Hedgehog)^.King then |
561 if PHedgehog(Gear^.Hedgehog)^.King then |
562 begin |
562 begin |
563 flag:= false; |
563 flag:= false; |
564 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
564 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
565 for i:= 0 to Pred(team^.HedgehogsNumber) do |
565 for i:= 0 to Pred(team^.HedgehogsNumber) do |
566 if (team^.Hedgehogs[i].Gear <> nil) and |
566 if (team^.Hedgehogs[i].Gear <> nil) and |
567 (not team^.Hedgehogs[i].King) and |
567 (not team^.Hedgehogs[i].King) and |
568 (team^.Hedgehogs[i].Gear^.Health > team^.Hedgehogs[i].Gear^.Damage) then flag:= true; |
568 (team^.Hedgehogs[i].Gear^.Health > team^.Hedgehogs[i].Gear^.Damage) then flag:= true; |
569 if not flag then inc(Gear^.Damage, min(5, max(0,Gear^.Health - 1 - Gear^.Damage))) |
569 if not flag then inc(Gear^.Damage, min(5, max(0,Gear^.Health - 1 - Gear^.Damage))) |
570 end |
570 end |
571 end; |
571 end; |
572 |
572 |
573 Gear:= Gear^.NextGear |
573 Gear:= Gear^.NextGear |
574 end; |
574 end; |
575 end; |
575 end; |
576 |
576 |
577 procedure ProcessGears; |
577 procedure ProcessGears; |
578 const delay: LongWord = 0; |
578 const delay: LongWord = 0; |
579 step: (stDelay, stChDmg, stSweep, stTurnReact, |
579 step: (stDelay, stChDmg, stSweep, stTurnReact, |
580 stAfterDelay, stChWin, stWater, stChWin2, stHealth, |
580 stAfterDelay, stChWin, stWater, stChWin2, stHealth, |
581 stSpawn, stNTurn) = stDelay; |
581 stSpawn, stNTurn) = stDelay; |
582 |
582 |
583 var Gear, t: PGear; |
583 var Gear, t: PGear; |
584 begin |
584 begin |
585 PrvInactive:= AllInactive; |
585 PrvInactive:= AllInactive; |
586 AllInactive:= true; |
586 AllInactive:= true; |
587 |
587 |
588 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then |
588 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then |
589 begin |
589 begin |
590 WriteLnToConsole('playsteps ...'); |
590 WriteLnToConsole('playsteps ...'); |
591 StepSoundChannel:= LoopSound(sndSteps) |
591 StepSoundChannel:= LoopSound(sndSteps) |
592 end |
592 end |
593 else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then |
593 else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then |
594 begin |
594 begin |
595 WriteLnToConsole('stopsteps ...'); |
595 WriteLnToConsole('stopsteps ...'); |
596 StopSound(StepSoundChannel); |
596 StopSound(StepSoundChannel); |
597 StepSoundChannel:= -1; |
597 StepSoundChannel:= -1; |
598 end; |
598 end; |
599 |
599 |
600 if StepSoundTimer > 0 then |
600 if StepSoundTimer > 0 then |
601 dec(StepSoundTimer, 1); |
601 dec(StepSoundTimer, 1); |
602 |
602 |
603 t:= GearsList; |
603 t:= GearsList; |
604 while t <> nil do |
604 while t <> nil do |
605 begin |
605 begin |
606 Gear:= t; |
606 Gear:= t; |
607 t:= Gear^.NextGear; |
607 t:= Gear^.NextGear; |
608 if Gear^.Active then |
608 if Gear^.Active then |
609 begin |
609 begin |
610 if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then |
610 if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then |
611 begin |
611 begin |
612 if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
612 if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
613 Gear^.Tex:= RenderStringTex(inttostr(Gear^.Timer div 1000), cWhiteColor, fntSmall); |
613 Gear^.Tex:= RenderStringTex(inttostr(Gear^.Timer div 1000), cWhiteColor, fntSmall); |
614 end; |
614 end; |
615 Gear^.doStep(Gear); |
615 Gear^.doStep(Gear); |
616 end |
616 end |
617 end; |
617 end; |
618 |
618 |
619 if AllInactive then |
619 if AllInactive then |
620 case step of |
620 case step of |
621 stDelay: begin |
621 stDelay: begin |
622 if delay = 0 then |
622 if delay = 0 then |
623 delay:= cInactDelay |
623 delay:= cInactDelay |
624 else |
624 else |
625 dec(delay); |
625 dec(delay); |
626 |
626 |
627 if delay = 0 then |
627 if delay = 0 then |
628 inc(step) |
628 inc(step) |
629 end; |
629 end; |
630 stChDmg: if CheckNoDamage then inc(step) else step:= stDelay; |
630 stChDmg: if CheckNoDamage then inc(step) else step:= stDelay; |
631 stSweep: if SweepDirty then |
631 stSweep: if SweepDirty then |
632 begin |
632 begin |
633 SetAllToActive; |
633 SetAllToActive; |
634 step:= stChDmg |
634 step:= stChDmg |
635 end else inc(step); |
635 end else inc(step); |
636 stTurnReact: begin |
636 stTurnReact: begin |
637 if (not bBetweenTurns) and (not isInMultiShoot) then |
637 if (not bBetweenTurns) and (not isInMultiShoot) then |
638 begin |
638 begin |
639 uStats.TurnReaction; |
639 uStats.TurnReaction; |
640 inc(step) |
640 inc(step) |
641 end else |
641 end else |
642 inc(step, 2); |
642 inc(step, 2); |
643 end; |
643 end; |
644 stAfterDelay: begin |
644 stAfterDelay: begin |
645 if delay = 0 then |
645 if delay = 0 then |
646 delay:= cInactDelay |
646 delay:= cInactDelay |
647 else |
647 else |
648 dec(delay); |
648 dec(delay); |
649 |
649 |
650 if delay = 0 then |
650 if delay = 0 then |
651 inc(step) |
651 inc(step) |
652 end; |
652 end; |
653 stChWin: begin |
653 stChWin: begin |
654 CheckForWin; |
654 CheckForWin; |
655 inc(step) |
655 inc(step) |
656 end; |
656 end; |
657 stWater: if (not bBetweenTurns) and (not isInMultiShoot) then |
657 stWater: if (not bBetweenTurns) and (not isInMultiShoot) then |
658 begin |
658 begin |
659 if TotalRounds = cSuddenDTurns + 2 then bWaterRising:= true; |
659 if TotalRounds = cSuddenDTurns + 2 then bWaterRising:= true; |
660 |
660 |
661 if bWaterRising then |
661 if bWaterRising then |
662 AddGear(0, 0, gtWaterUp, 0, _0, _0, 0); |
662 AddGear(0, 0, gtWaterUp, 0, _0, _0, 0); |
663 |
663 |
664 inc(step) |
664 inc(step) |
665 end else inc(step); |
665 end else inc(step); |
666 stChWin2: begin |
666 stChWin2: begin |
667 CheckForWin; |
667 CheckForWin; |
668 inc(step) |
668 inc(step) |
669 end; |
669 end; |
670 stHealth: begin |
670 stHealth: begin |
671 if (TotalRounds = cSuddenDTurns) and (cHealthDecrease = 0) then |
671 if (TotalRounds = cSuddenDTurns) and (cHealthDecrease = 0) then |
672 begin |
672 begin |
673 cHealthDecrease:= 5; |
673 cHealthDecrease:= 5; |
674 AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState); |
674 AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState); |
675 playSound(sndSuddenDeath) |
675 playSound(sndSuddenDeath) |
676 end; |
676 end; |
677 |
677 |
678 if bBetweenTurns |
678 if bBetweenTurns |
679 or isInMultiShoot |
679 or isInMultiShoot |
680 or (TotalRounds = 0) then inc(step) |
680 or (TotalRounds = 0) then inc(step) |
681 else begin |
681 else begin |
682 bBetweenTurns:= true; |
682 bBetweenTurns:= true; |
683 HealthMachine; |
683 HealthMachine; |
684 if cHealthDecrease > 0 then SuddenDeathDmg:= true; |
684 if cHealthDecrease > 0 then SuddenDeathDmg:= true; |
685 step:= stChDmg |
685 step:= stChDmg |
686 end |
686 end |
687 end; |
687 end; |
688 stSpawn: begin |
688 stSpawn: begin |
689 if not isInMultiShoot then SpawnBoxOfSmth; |
689 if not isInMultiShoot then SpawnBoxOfSmth; |
690 inc(step) |
690 inc(step) |
691 end; |
691 end; |
692 stNTurn: begin |
692 stNTurn: begin |
693 if isInMultiShoot then |
693 if isInMultiShoot then |
694 isInMultiShoot:= false |
694 isInMultiShoot:= false |
695 else begin |
695 else begin |
696 // delayed till after 0.9.12 |
696 // delayed till after 0.9.12 |
697 // reset to default zoom |
697 // reset to default zoom |
698 //ZoomValue:= ZoomDefault; |
698 //ZoomValue:= ZoomDefault; |
699 with CurrentHedgehog^ do |
699 with CurrentHedgehog^ do |
700 if (Gear <> nil) |
700 if (Gear <> nil) |
701 and ((Gear^.State and gstAttacked) = 0) |
701 and ((Gear^.State and gstAttacked) = 0) |
702 and (MultiShootAttacks > 0) then OnUsedAmmo(CurrentHedgehog^); |
702 and (MultiShootAttacks > 0) then OnUsedAmmo(CurrentHedgehog^); |
703 |
703 |
704 ResetUtilities; |
704 ResetUtilities; |
705 |
705 |
706 FreeActionsList; // could send -left, -right and similar commands, so should be called before /nextturn |
706 FreeActionsList; // could send -left, -right and similar commands, so should be called before /nextturn |
707 |
707 |
708 ParseCommand('/nextturn', true); |
708 ParseCommand('/nextturn', true); |
709 SwitchHedgehog; |
709 SwitchHedgehog; |
710 |
710 |
711 AfterSwitchHedgehog; |
711 AfterSwitchHedgehog; |
712 bBetweenTurns:= false |
712 bBetweenTurns:= false |
713 end; |
713 end; |
714 step:= Low(step) |
714 step:= Low(step) |
715 end; |
715 end; |
716 end; |
716 end; |
717 |
717 |
718 if TurnTimeLeft > 0 then |
718 if TurnTimeLeft > 0 then |
719 if CurrentHedgehog^.Gear <> nil then |
719 if CurrentHedgehog^.Gear <> nil then |
720 if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0) |
720 if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0) |
721 and not isInMultiShoot then |
721 and not isInMultiShoot then |
722 begin |
722 begin |
723 if (TurnTimeLeft = 5000) |
723 if (TurnTimeLeft = 5000) |
724 and (not PlacingHogs) |
724 and (not PlacingHogs) |
725 and (CurrentHedgehog^.Gear <> nil) |
725 and (CurrentHedgehog^.Gear <> nil) |
726 and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then |
726 and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then |
727 PlaySound(sndHurry, CurrentTeam^.voicepack); |
727 PlaySound(sndHurry, CurrentTeam^.voicepack); |
728 dec(TurnTimeLeft) |
728 dec(TurnTimeLeft) |
729 end; |
729 end; |
730 |
730 |
731 if skipFlag then |
731 if skipFlag then |
732 begin |
732 begin |
733 TurnTimeLeft:= 0; |
733 TurnTimeLeft:= 0; |
734 skipFlag:= false |
734 skipFlag:= false |
735 end; |
735 end; |
736 |
736 |
737 if ((GameTicks and $FFFF) = $FFFF) then |
737 if ((GameTicks and $FFFF) = $FFFF) then |
738 begin |
738 begin |
739 if (not CurrentTeam^.ExtDriven) then |
739 if (not CurrentTeam^.ExtDriven) then |
740 SendIPCTimeInc; |
740 SendIPCTimeInc; |
741 |
741 |
742 if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then |
742 if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then |
743 inc(hiTicks) // we do not recieve a message for this |
743 inc(hiTicks) // we do not recieve a message for this |
744 end; |
744 end; |
745 |
745 |
746 inc(GameTicks) |
746 inc(GameTicks) |
747 end; |
747 end; |
748 |
748 |
749 //Purpose, to reset all transient attributes toggled by a utility. |
749 //Purpose, to reset all transient attributes toggled by a utility. |
827 hwRound(CurrentHedgehog^.Gear^.Y), |
827 hwRound(CurrentHedgehog^.Gear^.Y), |
828 gtHealthTag, tmpDmg, _0, _0, 0)^.Hedgehog:= CurrentHedgehog; |
828 gtHealthTag, tmpDmg, _0, _0, 0)^.Hedgehog:= CurrentHedgehog; |
829 end; |
829 end; |
830 end; |
830 end; |
831 end; |
831 end; |
832 inc(Gear^.Damage, Damage); |
832 inc(Gear^.Damage, Damage); |
833 end; |
833 end; |
834 |
834 |
835 procedure SetAllToActive; |
835 procedure SetAllToActive; |
836 var t: PGear; |
836 var t: PGear; |
837 begin |
837 begin |
838 AllInactive:= false; |
838 AllInactive:= false; |
839 t:= GearsList; |
839 t:= GearsList; |
840 while t <> nil do |
840 while t <> nil do |
841 begin |
841 begin |
842 t^.Active:= true; |
842 t^.Active:= true; |
843 t:= t^.NextGear |
843 t:= t^.NextGear |
844 end |
844 end |
845 end; |
845 end; |
846 |
846 |
847 procedure SetAllHHToActive; |
847 procedure SetAllHHToActive; |
848 var t: PGear; |
848 var t: PGear; |
849 begin |
849 begin |
850 AllInactive:= false; |
850 AllInactive:= false; |
851 t:= GearsList; |
851 t:= GearsList; |
852 while t <> nil do |
852 while t <> nil do |
853 begin |
853 begin |
854 if t^.Kind = gtHedgehog then t^.Active:= true; |
854 if t^.Kind = gtHedgehog then t^.Active:= true; |
855 t:= t^.NextGear |
855 t:= t^.NextGear |
856 end |
856 end |
857 end; |
857 end; |
858 |
858 |
859 procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt); |
859 procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt); |
860 begin |
860 begin |
861 with PHedgehog(Gear^.Hedgehog)^ do |
861 with PHedgehog(Gear^.Hedgehog)^ do |
862 begin |
862 begin |
863 if not (((Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then |
863 if not (((Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then |
864 exit; |
864 exit; |
865 DrawTexture(round(sx + 16), round(sy + 16), ropeIconTex); |
865 DrawTexture(round(sx + 16), round(sy + 16), ropeIconTex); |
866 DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, round(sx + 30), round(sy + 30), ord(Ammo^[CurSlot, CurAmmo].AmmoType) - 1, 1, 32, 32); |
866 DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, round(sx + 30), round(sy + 30), ord(Ammo^[CurSlot, CurAmmo].AmmoType) - 1, 1, 32, 32); |
867 end; |
867 end; |
868 end; |
868 end; |
869 |
869 |
870 procedure DrawHH(Gear: PGear); |
870 procedure DrawHH(Gear: PGear); |
871 var i, t: LongInt; |
871 var i, t: LongInt; |
872 amt: TAmmoType; |
872 amt: TAmmoType; |
873 hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
873 hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
874 lx, ly, dx, dy, ax, ay, aAngle, dAngle, hAngle: real; // laser, change |
874 lx, ly, dx, dy, ax, ay, aAngle, dAngle, hAngle: real; // laser, change |
875 defaultPos, HatVisible: boolean; |
875 defaultPos, HatVisible: boolean; |
876 VertexBuffer: array [0..1] of TVertex2f; |
876 VertexBuffer: array [0..1] of TVertex2f; |
877 begin |
877 begin |
878 |
878 |
879 if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit; |
879 if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit; |
880 m:= 1; |
880 m:= 1; |
881 if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1; |
881 if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1; |
882 if (Gear^.State and gstHHDeath) <> 0 then |
882 if (Gear^.State and gstHHDeath) <> 0 then |
883 begin |
883 begin |
884 DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos); |
884 DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos); |
885 exit |
885 exit |
886 end; |
886 end; |
887 |
887 |
888 defaultPos:= true; |
888 defaultPos:= true; |
889 HatVisible:= false; |
889 HatVisible:= false; |
890 |
890 |
891 sx:= hwRound(Gear^.X) + 1 + WorldDx; |
891 sx:= hwRound(Gear^.X) + 1 + WorldDx; |
892 sy:= hwRound(Gear^.Y) - 3 + WorldDy; |
892 sy:= hwRound(Gear^.Y) - 3 + WorldDy; |
893 if ((Gear^.State and gstWinner) <> 0) and |
893 if ((Gear^.State and gstWinner) <> 0) and |
894 ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then |
894 ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then |
895 begin |
895 begin |
896 DrawHedgehog(sx, sy, |
896 DrawHedgehog(sx, sy, |
897 hwSign(Gear^.dX), |
897 hwSign(Gear^.dX), |
898 2, |
898 2, |
899 0, |
899 0, |
900 0); |
900 0); |
901 defaultPos:= false |
901 defaultPos:= false |
902 end; |
902 end; |
903 if (Gear^.State and gstDrowning) <> 0 then |
903 if (Gear^.State and gstDrowning) <> 0 then |
904 begin |
904 begin |
905 DrawHedgehog(sx, sy, |
905 DrawHedgehog(sx, sy, |
906 hwSign(Gear^.dX), |
906 hwSign(Gear^.dX), |
907 1, |
907 1, |
908 7, |
908 7, |
909 0); |
909 0); |
910 defaultPos:= false |
910 defaultPos:= false |
911 end else |
911 end else |
912 if (Gear^.State and gstLoser) <> 0 then // for now using the jackhammer for its kind of bemused "oops" look |
912 if (Gear^.State and gstLoser) <> 0 then // for now using the jackhammer for its kind of bemused "oops" look |
913 begin |
913 begin |
914 DrawHedgehog(sx, sy, |
914 DrawHedgehog(sx, sy, |
915 hwSign(Gear^.dX), |
915 hwSign(Gear^.dX), |
916 2, |
916 2, |
917 3, |
917 3, |
918 0); |
918 0); |
919 defaultPos:= false |
919 defaultPos:= false |
920 end else |
920 end else |
921 |
921 |
922 if (Gear^.State and gstHHDriven) <> 0 then |
922 if (Gear^.State and gstHHDriven) <> 0 then |
923 begin |
923 begin |
924 if ((Gear^.State and gstHHThinking) = 0) and |
924 if ((Gear^.State and gstHHThinking) = 0) and |
925 ShowCrosshair and |
925 ShowCrosshair and |
926 ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
926 ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
927 begin |
927 begin |
928 (* These calculations are a little complex for a few reasons: |
928 (* These calculations are a little complex for a few reasons: |
929 1: I need to draw the laser from weapon origin to nearest land |
929 1: I need to draw the laser from weapon origin to nearest land |
930 2: I need to start the beam outside the hedgie for attractiveness. |
930 2: I need to start the beam outside the hedgie for attractiveness. |
931 3: I need to extend the beam beyond land. |
931 3: I need to extend the beam beyond land. |
932 This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. |
932 This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. |
933 *) |
933 *) |
934 dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle); |
934 dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle); |
935 dy:= - Cos(Gear^.Angle * pi / cMaxAngle); |
935 dy:= - Cos(Gear^.Angle * pi / cMaxAngle); |
936 if cLaserSighting then |
936 if cLaserSighting then |
937 begin |
937 begin |
938 lx:= hwRound(Gear^.X); |
938 lx:= hwRound(Gear^.X); |
939 ly:= hwRound(Gear^.Y); |
939 ly:= hwRound(Gear^.Y); |
940 lx:= lx + dx * 16; |
940 lx:= lx + dx * 16; |
941 ly:= ly + dy * 16; |
941 ly:= ly + dy * 16; |
942 |
942 |
943 ax:= dx * 4; |
943 ax:= dx * 4; |
944 ay:= dy * 4; |
944 ay:= dy * 4; |
945 |
945 |
946 tx:= round(lx); |
946 tx:= round(lx); |
947 ty:= round(ly); |
947 ty:= round(ly); |
948 hx:= tx; |
948 hx:= tx; |
949 hy:= ty; |
949 hy:= ty; |
950 while ((ty and LAND_HEIGHT_MASK) = 0) and |
950 while ((ty and LAND_HEIGHT_MASK) = 0) and |
951 ((tx and LAND_WIDTH_MASK) = 0) and |
951 ((tx and LAND_WIDTH_MASK) = 0) and |
952 (Land[ty, tx] = 0) do |
952 (Land[ty, tx] = 0) do |
953 begin |
953 begin |
954 lx:= lx + ax; |
954 lx:= lx + ax; |
955 ly:= ly + ay; |
955 ly:= ly + ay; |
956 tx:= round(lx); |
956 tx:= round(lx); |
957 ty:= round(ly) |
957 ty:= round(ly) |
958 end; |
958 end; |
959 // reached edge of land. assume infinite beam. Extend it way out past camera |
959 // reached edge of land. assume infinite beam. Extend it way out past camera |
960 if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then |
960 if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then |
961 begin |
961 begin |
962 tx:= round(lx + ax * (LAND_WIDTH div 4)); |
962 tx:= round(lx + ax * (LAND_WIDTH div 4)); |
963 ty:= round(ly + ay * (LAND_WIDTH div 4)); |
963 ty:= round(ly + ay * (LAND_WIDTH div 4)); |
964 end; |
964 end; |
965 |
965 |
966 //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then |
966 //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then |
967 begin |
967 begin |
968 glDisable(GL_TEXTURE_2D); |
968 glDisable(GL_TEXTURE_2D); |
969 glEnable(GL_LINE_SMOOTH); |
969 glEnable(GL_LINE_SMOOTH); |
970 |
970 |
971 glLineWidth(1.0); |
971 glLineWidth(1.0); |
972 |
972 |
973 glColor4ub($FF, $00, $00, $C0); |
973 glColor4ub($FF, $00, $00, $C0); |
974 VertexBuffer[0].X:= hx + WorldDx; |
974 VertexBuffer[0].X:= hx + WorldDx; |
975 VertexBuffer[0].Y:= hy + WorldDy; |
975 VertexBuffer[0].Y:= hy + WorldDy; |
976 VertexBuffer[1].X:= tx + WorldDx; |
976 VertexBuffer[1].X:= tx + WorldDx; |
977 VertexBuffer[1].Y:= ty + WorldDy; |
977 VertexBuffer[1].Y:= ty + WorldDy; |
978 |
978 |
979 glEnableClientState(GL_VERTEX_ARRAY); |
979 glEnableClientState(GL_VERTEX_ARRAY); |
980 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
980 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
981 glDrawArrays(GL_LINES, 0, Length(VertexBuffer)); |
981 glDrawArrays(GL_LINES, 0, Length(VertexBuffer)); |
982 glColor4f(1, 1, 1, 1); |
982 glColor4f(1, 1, 1, 1); |
983 glEnable(GL_TEXTURE_2D); |
983 glEnable(GL_TEXTURE_2D); |
984 glDisable(GL_LINE_SMOOTH); |
984 glDisable(GL_LINE_SMOOTH); |
985 end; |
985 end; |
986 end; |
986 end; |
987 // draw crosshair |
987 // draw crosshair |
988 cx:= Round(hwRound(Gear^.X) + dx * 80); |
988 cx:= Round(hwRound(Gear^.X) + dx * 80); |
989 cy:= Round(hwRound(Gear^.Y) + dy * 80); |
989 cy:= Round(hwRound(Gear^.Y) + dy * 80); |
990 DrawRotatedTex(PHedgehog(Gear^.Hedgehog)^.Team^.CrosshairTex, |
990 DrawRotatedTex(PHedgehog(Gear^.Hedgehog)^.Team^.CrosshairTex, |
991 12, 12, cx + WorldDx, cy + WorldDy, 0, |
991 12, 12, cx + WorldDx, cy + WorldDy, 0, |
992 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle); |
992 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle); |
993 end; |
993 end; |
994 hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx; |
994 hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx; |
995 hy:= hwRound(Gear^.Y) - 2 + WorldDy; |
995 hy:= hwRound(Gear^.Y) - 2 + WorldDy; |
996 aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
996 aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
997 |
997 |
998 if CurAmmoGear <> nil then |
998 if CurAmmoGear <> nil then |
999 begin |
999 begin |
1000 case CurAmmoGear^.Kind of |
1000 case CurAmmoGear^.Kind of |
1001 gtShotgunShot: begin |
1001 gtShotgunShot: begin |
1002 if (CurAmmoGear^.State and gstAnimation <> 0) then |
1002 if (CurAmmoGear^.State and gstAnimation <> 0) then |
1003 DrawRotated(sprShotgun, hx, hy, hwSign(Gear^.dX), aangle) |
1003 DrawRotated(sprShotgun, hx, hy, hwSign(Gear^.dX), aangle) |
1004 else |
1004 else |
1005 DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
1005 DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
1006 end; |
1006 end; |
1007 gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
1007 gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
1008 gtSniperRifleShot: begin |
1008 gtSniperRifleShot: begin |
1009 if (CurAmmoGear^.State and gstAnimation <> 0) then |
1009 if (CurAmmoGear^.State and gstAnimation <> 0) then |
1010 DrawRotatedF(sprSniperRifle, hx, hy, 1, hwSign(Gear^.dX), aangle) |
1010 DrawRotatedF(sprSniperRifle, hx, hy, 1, hwSign(Gear^.dX), aangle) |
1011 else |
1011 else |
1012 DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle) |
1012 DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle) |
1013 end; |
1013 end; |
1014 gtBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
1014 gtBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
1015 gtRCPlane: begin |
1015 gtRCPlane: begin |
1016 DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); |
1016 DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); |
1017 defaultPos:= false |
1017 defaultPos:= false |
1018 end; |
1018 end; |
1019 gtRope: begin |
1019 gtRope: begin |
1020 if Gear^.X < CurAmmoGear^.X then |
1020 if Gear^.X < CurAmmoGear^.X then |
1021 begin |
1021 begin |
1022 dAngle:= 0; |
1022 dAngle:= 0; |
1023 hAngle:= 180; |
1023 hAngle:= 180; |
1024 i:= 1 |
1024 i:= 1 |
1025 end else |
1025 end else |
1026 begin |
1026 begin |
1027 dAngle:= 180; |
1027 dAngle:= 180; |
1028 hAngle:= 0; |
1028 hAngle:= 0; |
1029 i:= -1 |
1029 i:= -1 |
1030 end; |
1030 end; |
1031 sx:= hwRound(Gear^.X) + WorldDx; |
1031 sx:= hwRound(Gear^.X) + WorldDx; |
1032 sy:= hwRound(Gear^.Y) + WorldDy; |
1032 sy:= hwRound(Gear^.Y) + WorldDy; |
1033 if ((Gear^.State and gstWinner) = 0) then |
1033 if ((Gear^.State and gstWinner) = 0) then |
1034 begin |
1034 begin |
1035 DrawHedgehog(sx, sy, |
1035 DrawHedgehog(sx, sy, |
1040 with PHedgehog(Gear^.Hedgehog)^ do |
1040 with PHedgehog(Gear^.Hedgehog)^ do |
1041 if (HatTex <> nil) then |
1041 if (HatTex <> nil) then |
1042 DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, sx, sy, 0, i, 32, 32, |
1042 DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, sx, sy, 0, i, 32, 32, |
1043 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
1043 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); |
1044 end; |
1044 end; |
1045 DrawAltWeapon(Gear, sx, sy); |
1045 DrawAltWeapon(Gear, sx, sy); |
1046 defaultPos:= false |
1046 defaultPos:= false |
1047 end; |
1047 end; |
1048 gtBlowTorch: begin |
1048 gtBlowTorch: begin |
1049 DrawRotated(sprBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
1049 DrawRotated(sprBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
1050 DrawHedgehog(sx, sy, |
1050 DrawHedgehog(sx, sy, |
1051 hwSign(Gear^.dX), |
1051 hwSign(Gear^.dX), |
1052 3, |
1052 3, |
1053 PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
1053 PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
1054 0); |
1054 0); |
1055 with PHedgehog(Gear^.Hedgehog)^ do |
1055 with PHedgehog(Gear^.Hedgehog)^ do |
1056 if (HatTex <> nil) then |
1056 if (HatTex <> nil) then |
1057 DrawTextureF(HatTex, |
1057 DrawTextureF(HatTex, |
1058 1, |
1058 1, |
1059 sx, |
1059 sx, |
1060 hwRound(Gear^.Y) - 8 + WorldDy, |
1060 hwRound(Gear^.Y) - 8 + WorldDy, |
1061 0, |
1061 0, |
1062 hwSign(Gear^.dX), |
1062 hwSign(Gear^.dX), |
1063 32, |
1063 32, |
1064 32); |
1064 32); |
1065 defaultPos:= false |
1065 defaultPos:= false |
1066 end; |
1066 end; |
1067 gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180); |
1067 gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180); |
1068 gtFirePunch: begin |
1068 gtFirePunch: begin |
1069 DrawHedgehog(sx, sy, |
1069 DrawHedgehog(sx, sy, |
1070 hwSign(Gear^.dX), |
1070 hwSign(Gear^.dX), |
1071 1, |
1071 1, |
1072 4, |
1072 4, |
1073 0); |
1073 0); |
1074 defaultPos:= false |
1074 defaultPos:= false |
1075 end; |
1075 end; |
1076 gtPickHammer: begin |
1076 gtPickHammer: begin |
1077 defaultPos:= false; |
1077 defaultPos:= false; |
1078 dec(sy,20); |
1078 dec(sy,20); |
1079 end; |
1079 end; |
1080 gtTeleport: defaultPos:= false; |
1080 gtTeleport: defaultPos:= false; |
1081 gtWhip: begin |
1081 gtWhip: begin |
1082 DrawRotatedF(sprWhip, |
1082 DrawRotatedF(sprWhip, |
1083 sx, |
1083 sx, |
1084 sy, |
1084 sy, |
1085 1, |
1085 1, |
1086 hwSign(Gear^.dX), |
1086 hwSign(Gear^.dX), |
1087 0); |
1087 0); |
1088 defaultPos:= false |
1088 defaultPos:= false |
1089 end; |
1089 end; |
1090 gtKamikaze: begin |
1090 gtKamikaze: begin |
1091 if CurAmmoGear^.Pos = 0 then |
1091 if CurAmmoGear^.Pos = 0 then |
1092 DrawHedgehog(sx, sy, |
1092 DrawHedgehog(sx, sy, |
1093 hwSign(Gear^.dX), |
1093 hwSign(Gear^.dX), |
1094 1, |
1094 1, |
1095 6, |
1095 6, |
1096 0) |
1096 0) |
1097 else |
1097 else |
1098 DrawRotatedF(sprKamikaze, |
1098 DrawRotatedF(sprKamikaze, |
1099 hwRound(Gear^.X) + WorldDx, |
1099 hwRound(Gear^.X) + WorldDx, |
1100 hwRound(Gear^.Y) + WorldDy, |
1100 hwRound(Gear^.Y) + WorldDy, |
1101 CurAmmoGear^.Pos - 1, |
1101 CurAmmoGear^.Pos - 1, |
1102 hwSign(Gear^.dX), |
1102 hwSign(Gear^.dX), |
1103 aangle); |
1103 aangle); |
1104 defaultPos:= false |
1104 defaultPos:= false |
1105 end; |
1105 end; |
1106 gtSeduction: begin |
1106 gtSeduction: begin |
1107 if CurAmmoGear^.Pos >= 6 then |
1107 if CurAmmoGear^.Pos >= 6 then |
1108 DrawHedgehog(sx, sy, |
1108 DrawHedgehog(sx, sy, |
1109 hwSign(Gear^.dX), |
1109 hwSign(Gear^.dX), |
1110 2, |
1110 2, |
1111 2, |
1111 2, |
1112 0) |
1112 0) |
1113 else |
1113 else |
1114 begin |
1114 begin |
1115 DrawRotatedF(sprDress, |
1115 DrawRotatedF(sprDress, |
1116 hwRound(Gear^.X) + WorldDx, |
1116 hwRound(Gear^.X) + WorldDx, |
1117 hwRound(Gear^.Y) + WorldDy, |
1117 hwRound(Gear^.Y) + WorldDy, |
1118 CurAmmoGear^.Pos, |
1118 CurAmmoGear^.Pos, |
1119 hwSign(Gear^.dX), |
1119 hwSign(Gear^.dX), |
1120 0); |
1120 0); |
1121 DrawSprite(sprCensored, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 20 + WorldDy, 0) |
1121 DrawSprite(sprCensored, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 20 + WorldDy, 0) |
1122 end; |
1122 end; |
1123 defaultPos:= false |
1123 defaultPos:= false |
1124 end; |
1124 end; |
1125 end; |
1125 end; |
1126 |
1126 |
1127 case CurAmmoGear^.Kind of |
1127 case CurAmmoGear^.Kind of |
1128 gtShotgunShot, |
1128 gtShotgunShot, |
1129 gtDEagleShot, |
1129 gtDEagleShot, |
1130 gtSniperRifleShot, |
1130 gtSniperRifleShot, |
1131 gtShover: begin |
1131 gtShover: begin |
1132 DrawHedgehog(sx, sy, |
1132 DrawHedgehog(sx, sy, |
1133 hwSign(Gear^.dX), |
1133 hwSign(Gear^.dX), |
1134 0, |
1134 0, |
1135 4, |
1135 4, |
1136 0); |
1136 0); |
1137 defaultPos:= false; |
1137 defaultPos:= false; |
1138 HatVisible:= true |
1138 HatVisible:= true |
1139 end |
1139 end |
1140 end |
1140 end |
1141 end else |
1141 end else |
1142 |
1142 |
1143 if ((Gear^.State and gstHHJumping) <> 0) then |
1143 if ((Gear^.State and gstHHJumping) <> 0) then |
1144 begin |
1144 begin |
1145 DrawHedgehog(sx, sy, |
1145 DrawHedgehog(sx, sy, |
1146 hwSign(Gear^.dX)*m, |
1146 hwSign(Gear^.dX)*m, |
1147 1, |
1147 1, |
1148 1, |
1148 1, |
1149 0); |
1149 0); |
1150 HatVisible:= true; |
1150 HatVisible:= true; |
1151 defaultPos:= false |
1151 defaultPos:= false |
1152 end else |
1152 end else |
1153 |
1153 |
1154 if (Gear^.Message and (gm_Left or gm_Right) <> 0) and (not isCursorVisible) then |
1154 if (Gear^.Message and (gm_Left or gm_Right) <> 0) and (not isCursorVisible) then |
1155 begin |
1155 begin |
1156 DrawHedgehog(sx, sy, |
1156 DrawHedgehog(sx, sy, |
1157 hwSign(Gear^.dX), |
1157 hwSign(Gear^.dX), |
1158 0, |
1158 0, |
1159 PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
1159 PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
1160 0); |
1160 0); |
1161 defaultPos:= false; |
1161 defaultPos:= false; |
1162 HatVisible:= true |
1162 HatVisible:= true |
1163 end |
1163 end |
1164 else |
1164 else |
1165 |
1165 |
1166 if ((Gear^.State and gstAnimation) <> 0) then |
1166 if ((Gear^.State and gstAnimation) <> 0) then |
1167 begin |
1167 begin |
1168 DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
1168 DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
1169 sx, |
1169 sx, |
1170 sy, |
1170 sy, |
1171 Gear^.Pos, |
1171 Gear^.Pos, |
1172 hwSign(Gear^.dX), |
1172 hwSign(Gear^.dX), |
1173 0.0); |
1173 0.0); |
1174 defaultPos:= false |
1174 defaultPos:= false |
1175 end |
1175 end |
1176 else |
1176 else |
1177 if ((Gear^.State and gstAttacked) = 0) then |
1177 if ((Gear^.State and gstAttacked) = 0) then |
1178 begin |
1178 begin |
1179 amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
1179 amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
1180 case amt of |
1180 case amt of |
1181 amBazooka, |
1181 amBazooka, |
1182 amMortar: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle); |
1182 amMortar: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle); |
1183 amMolotov: DrawRotated(sprHandMolotov, hx, hy, hwSign(Gear^.dX), aangle); |
1183 amMolotov: DrawRotated(sprHandMolotov, hx, hy, hwSign(Gear^.dX), aangle); |
1184 amBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
1184 amBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
1185 amDrill: DrawRotated(sprHandDrill, hx, hy, hwSign(Gear^.dX), aangle); |
1185 amDrill: DrawRotated(sprHandDrill, hx, hy, hwSign(Gear^.dX), aangle); |
1186 amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle); |
1186 amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle); |
1187 amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
1187 amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
1188 amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
1188 amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
1189 amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle); |
1189 amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle); |
1190 amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
1190 amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
1191 amRCPlane: begin |
1191 amRCPlane: begin |
1192 DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); |
1192 DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); |
1193 defaultPos:= false |
1193 defaultPos:= false |
1194 end; |
1194 end; |
1195 amGirder: begin |
1195 amGirder: begin |
1196 DrawSpriteClipped(sprGirder, |
1196 DrawSpriteClipped(sprGirder, |
1197 sx-256, |
1197 sx-256, |
1198 sy-256, |
1198 sy-256, |
1199 LongInt(topY)+WorldDy, |
1199 LongInt(topY)+WorldDy, |
1200 LongInt(rightX)+WorldDx, |
1200 LongInt(rightX)+WorldDx, |
1201 cWaterLine+WorldDy, |
1201 cWaterLine+WorldDy, |
1202 LongInt(leftX)+WorldDx); |
1202 LongInt(leftX)+WorldDx); |
1203 end; |
1203 end; |
1204 end; |
1204 end; |
1205 |
1205 |
1206 case amt of |
1206 case amt of |
1207 amAirAttack, |
1207 amAirAttack, |
1208 amMineStrike: DrawRotated(sprHandAirAttack, sx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0); |
1208 amMineStrike: DrawRotated(sprHandAirAttack, sx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0); |
1209 amPickHammer: DrawHedgehog(sx, sy, |
1209 amPickHammer: DrawHedgehog(sx, sy, |
1210 hwSign(Gear^.dX), |
1210 hwSign(Gear^.dX), |
1211 1, |
1211 1, |
1212 2, |
1212 2, |
1213 0); |
1213 0); |
1214 amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, hwSign(Gear^.dX), 0); |
1214 amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, hwSign(Gear^.dX), 0); |
1215 amKamikaze: DrawHedgehog(sx, sy, |
1215 amKamikaze: DrawHedgehog(sx, sy, |
1216 hwSign(Gear^.dX), |
1216 hwSign(Gear^.dX), |
1217 1, |
1217 1, |
1218 5, |
1218 5, |
1219 0); |
1219 0); |
1220 amWhip: DrawRotatedF(sprWhip, |
1220 amWhip: DrawRotatedF(sprWhip, |
1221 sx, |
1221 sx, |
1222 sy, |
1222 sy, |
1223 0, |
1223 0, |
1224 hwSign(Gear^.dX), |
1224 hwSign(Gear^.dX), |
1225 0); |
1225 0); |
1226 else |
1226 else |
1227 DrawHedgehog(sx, sy, |
1227 DrawHedgehog(sx, sy, |
1228 hwSign(Gear^.dX), |
1228 hwSign(Gear^.dX), |
1229 0, |
1229 0, |
1230 4, |
1230 4, |
1231 0); |
1231 0); |
1232 |
1232 |
1233 HatVisible:= true; |
1233 HatVisible:= true; |
1234 with PHedgehog(Gear^.Hedgehog)^ do |
1234 with PHedgehog(Gear^.Hedgehog)^ do |
1235 if (HatTex <> nil) |
1235 if (HatTex <> nil) |
1236 and (HatVisibility > 0) then |
1236 and (HatVisibility > 0) then |
1237 DrawTextureF(HatTex, |
1237 DrawTextureF(HatTex, |
1238 HatVisibility, |
1238 HatVisibility, |
1239 sx, |
1239 sx, |
1240 hwRound(Gear^.Y) - 8 + WorldDy, |
1240 hwRound(Gear^.Y) - 8 + WorldDy, |
1241 0, |
1241 0, |
1242 hwSign(Gear^.dX), |
1242 hwSign(Gear^.dX), |
1243 32, |
1243 32, |
1244 32); |
1244 32); |
1245 end; |
1245 end; |
1246 |
1246 |
1247 case amt of |
1247 case amt of |
1248 amBaseballBat: DrawRotated(sprHandBaseball, |
1248 amBaseballBat: DrawRotated(sprHandBaseball, |
1249 hwRound(Gear^.X) + 1 - 4 * hwSign(Gear^.dX) + WorldDx, |
1249 hwRound(Gear^.X) + 1 - 4 * hwSign(Gear^.dX) + WorldDx, |
1250 hwRound(Gear^.Y) + 6 + WorldDy, hwSign(Gear^.dX), aangle); |
1250 hwRound(Gear^.Y) + 6 + WorldDy, hwSign(Gear^.dX), aangle); |
1251 end; |
1251 end; |
1252 |
1252 |
1253 defaultPos:= false |
1253 defaultPos:= false |
1254 end; |
1254 end; |
1255 |
1255 |
1256 end else // not gstHHDriven |
1256 end else // not gstHHDriven |
1257 begin |
1257 begin |
1258 if (Gear^.Damage > 0) |
1258 if (Gear^.Damage > 0) |
1259 and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
1259 and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
1260 begin |
1260 begin |
1261 DrawHedgehog(sx, sy, |
1261 DrawHedgehog(sx, sy, |
1262 hwSign(Gear^.dX), |
1262 hwSign(Gear^.dX), |
1263 2, |
1263 2, |
1264 1, |
1264 1, |
1265 Gear^.DirAngle); |
1265 Gear^.DirAngle); |
1266 defaultPos:= false |
1266 defaultPos:= false |
1267 end else |
1267 end else |
1268 |
1268 |
1269 if ((Gear^.State and gstHHJumping) <> 0) then |
1269 if ((Gear^.State and gstHHJumping) <> 0) then |
1270 begin |
1270 begin |
1271 DrawHedgehog(sx, sy, |
1271 DrawHedgehog(sx, sy, |
1272 hwSign(Gear^.dX)*m, |
1272 hwSign(Gear^.dX)*m, |
1273 1, |
1273 1, |
1274 1, |
1274 1, |
1275 0); |
1275 0); |
1276 defaultPos:= false |
1276 defaultPos:= false |
1277 end; |
1277 end; |
1278 end; |
1278 end; |
1279 |
1279 |
1280 with PHedgehog(Gear^.Hedgehog)^ do |
1280 with PHedgehog(Gear^.Hedgehog)^ do |
1281 begin |
1281 begin |
1282 if defaultPos then |
1282 if defaultPos then |
1283 begin |
1283 begin |
1284 DrawRotatedF(sprHHIdle, |
1284 DrawRotatedF(sprHHIdle, |
1285 sx, |
1285 sx, |
1286 sy, |
1286 sy, |
1287 (RealTicks div 128 + Gear^.Pos) mod 19, |
1287 (RealTicks div 128 + Gear^.Pos) mod 19, |
1288 hwSign(Gear^.dX), |
1288 hwSign(Gear^.dX), |
1289 0); |
1289 0); |
1290 HatVisible:= true; |
1290 HatVisible:= true; |
1291 end; |
1291 end; |
1292 |
1292 |
1293 if HatVisible then |
1293 if HatVisible then |
1294 if HatVisibility < 1.0 then |
1294 if HatVisibility < 1.0 then |
1295 HatVisibility:= HatVisibility + 0.2 |
1295 HatVisibility:= HatVisibility + 0.2 |
1296 else |
1296 else |
1297 else |
1297 else |
1298 if HatVisibility > 0.0 then |
1298 if HatVisibility > 0.0 then |
1299 HatVisibility:= HatVisibility - 0.2; |
1299 HatVisibility:= HatVisibility - 0.2; |
1300 |
1300 |
1301 if (HatTex <> nil) |
1301 if (HatTex <> nil) |
1302 and (HatVisibility > 0) then |
1302 and (HatVisibility > 0) then |
1303 if DefaultPos then |
1303 if DefaultPos then |
1304 DrawTextureF(HatTex, |
1304 DrawTextureF(HatTex, |
1305 HatVisibility, |
1305 HatVisibility, |
1306 sx, |
1306 sx, |
1307 hwRound(Gear^.Y) - 8 + WorldDy, |
1307 hwRound(Gear^.Y) - 8 + WorldDy, |
1308 (RealTicks div 128 + Gear^.Pos) mod 19, |
1308 (RealTicks div 128 + Gear^.Pos) mod 19, |
1309 hwSign(Gear^.dX), |
1309 hwSign(Gear^.dX), |
1310 32, |
1310 32, |
1311 32) |
1311 32) |
1312 else |
1312 else |
1313 DrawTextureF(HatTex, |
1313 DrawTextureF(HatTex, |
1314 HatVisibility, |
1314 HatVisibility, |
1315 sx, |
1315 sx, |
1316 hwRound(Gear^.Y) - 8 + WorldDy, |
1316 hwRound(Gear^.Y) - 8 + WorldDy, |
1317 0, |
1317 0, |
1318 hwSign(Gear^.dX)*m, |
1318 hwSign(Gear^.dX)*m, |
1319 32, |
1319 32, |
1320 32); |
1320 32); |
1321 end; |
1321 end; |
1322 if (Gear^.State and gstHHDriven) <> 0 then |
1322 if (Gear^.State and gstHHDriven) <> 0 then |
1323 begin |
1323 begin |
1324 (* if (CurAmmoGear = nil) then |
1324 (* if (CurAmmoGear = nil) then |
1325 begin |
1325 begin |
1326 amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
1326 amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
1330 end; *) |
1330 end; *) |
1331 if CurAmmoGear <> nil then |
1331 if CurAmmoGear <> nil then |
1332 begin |
1332 begin |
1333 case CurAmmoGear^.Kind of |
1333 case CurAmmoGear^.Kind of |
1334 gtJetpack: begin |
1334 gtJetpack: begin |
1335 DrawSprite(sprJetpack, sx-32, sy-32, 0); |
1335 DrawSprite(sprJetpack, sx-32, sy-32, 0); |
1336 if (CurAmmoGear^.MsgParam and gm_Up) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 1); |
1336 if (CurAmmoGear^.MsgParam and gm_Up) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 1); |
1337 if (CurAmmoGear^.MsgParam and gm_Left) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 2); |
1337 if (CurAmmoGear^.MsgParam and gm_Left) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 2); |
1338 if (CurAmmoGear^.MsgParam and gm_Right) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 3); |
1338 if (CurAmmoGear^.MsgParam and gm_Right) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 3); |
1339 if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex); |
1339 if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex); |
1340 DrawAltWeapon(Gear, sx, sy) |
1340 DrawAltWeapon(Gear, sx, sy) |
1341 end; |
1341 end; |
1342 end; |
1342 end; |
1343 end |
1343 end |
1344 end; |
1344 end; |
1345 |
1345 |
1346 with PHedgehog(Gear^.Hedgehog)^ do |
1346 with PHedgehog(Gear^.Hedgehog)^ do |
1347 begin |
1347 begin |
1348 if ((Gear^.State and not gstWinner) = 0) |
1348 if ((Gear^.State and not gstWinner) = 0) |
1349 or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
1349 or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
1350 begin |
1350 begin |
1351 t:= hwRound(Gear^.Y) - cHHRadius - 12 + WorldDy; |
1351 t:= hwRound(Gear^.Y) - cHHRadius - 12 + WorldDy; |
1352 if (cTagsMask and htTransparent) <> 0 then |
1352 if (cTagsMask and htTransparent) <> 0 then |
1353 glColor4f(1, 1, 1, 0.5); |
1353 glColor4f(1, 1, 1, 0.5); |
1354 if ((cTagsMask and htHealth) <> 0) then |
1354 if ((cTagsMask and htHealth) <> 0) then |
1355 begin |
1355 begin |
1356 dec(t, HealthTagTex^.h + 2); |
1356 dec(t, HealthTagTex^.h + 2); |
1357 DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex) |
1357 DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex) |
1358 end; |
1358 end; |
1359 if (cTagsMask and htName) <> 0 then |
1359 if (cTagsMask and htName) <> 0 then |
1360 begin |
1360 begin |
1361 dec(t, NameTagTex^.h + 2); |
1361 dec(t, NameTagTex^.h + 2); |
1362 DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex) |
1362 DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex) |
1363 end; |
1363 end; |
1364 if (cTagsMask and htTeamName) <> 0 then |
1364 if (cTagsMask and htTeamName) <> 0 then |
1365 begin |
1365 begin |
1366 dec(t, Team^.NameTagTex^.h + 2); |
1366 dec(t, Team^.NameTagTex^.h + 2); |
1367 DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex) |
1367 DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex) |
1368 end; |
1368 end; |
1369 if (cTagsMask and htTransparent) <> 0 then |
1369 if (cTagsMask and htTransparent) <> 0 then |
1370 glColor4f(1, 1, 1, 1) |
1370 glColor4f(1, 1, 1, 1) |
1371 end; |
1371 end; |
1372 if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
1372 if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
1373 begin |
1373 begin |
1374 if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
1374 if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
1375 DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy, |
1375 DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy, |
1376 GameTicks div 32 mod 16); |
1376 GameTicks div 32 mod 16); |
1377 |
1377 |
1378 if (Gear^.State and gstDrowning) = 0 then |
1378 if (Gear^.State and gstDrowning) = 0 then |
1379 if (Gear^.State and gstHHThinking) <> 0 then |
1379 if (Gear^.State and gstHHThinking) <> 0 then |
1380 DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0) |
1380 DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0) |
1381 end |
1381 end |
1382 end; |
1382 end; |
1383 |
1383 |
1384 if Gear^.Invulnerable then |
1384 if Gear^.Invulnerable then |
1385 begin |
1385 begin |
1386 glColor4f(1, 1, 1, 0.25 + abs(1 - ((RealTicks div 2) mod 1500) / 750)); |
1386 glColor4f(1, 1, 1, 0.25 + abs(1 - ((RealTicks div 2) mod 1500) / 750)); |
1387 DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
1387 DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
1388 glColor4f(1, 1, 1, 1); |
1388 glColor4f(1, 1, 1, 1); |
1389 end; |
1389 end; |
1390 if cVampiric and |
1390 if cVampiric and |
1391 (CurrentHedgehog^.Gear <> nil) and |
1391 (CurrentHedgehog^.Gear <> nil) and |
1392 (CurrentHedgehog^.Gear = Gear) then |
1392 (CurrentHedgehog^.Gear = Gear) then |
1393 begin |
1393 begin |
1394 glColor4f(1, 1, 1, 0.25 + abs(1 - (RealTicks mod 1500) / 750)); |
1394 glColor4f(1, 1, 1, 0.25 + abs(1 - (RealTicks mod 1500) / 750)); |
1395 DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
1395 DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
1396 glColor4f(1, 1, 1, 1); |
1396 glColor4f(1, 1, 1, 1); |
1397 end; |
1397 end; |
1398 end; |
1398 end; |
1399 |
1399 |
1400 procedure DrawRopeLinesRQ(Gear: PGear); |
1400 procedure DrawRopeLinesRQ(Gear: PGear); |
1401 begin |
1401 begin |
1402 with RopePoints do |
1402 with RopePoints do |
1403 begin |
1403 begin |
1404 rounded[Count].X:= hwRound(Gear^.X); |
1404 rounded[Count].X:= hwRound(Gear^.X); |
1405 rounded[Count].Y:= hwRound(Gear^.Y); |
1405 rounded[Count].Y:= hwRound(Gear^.Y); |
1406 rounded[Count + 1].X:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X); |
1406 rounded[Count + 1].X:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X); |
1407 rounded[Count + 1].Y:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y); |
1407 rounded[Count + 1].Y:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y); |
1408 end; |
1408 end; |
1409 |
1409 |
1410 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then |
1410 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then |
1411 begin |
1411 begin |
1412 glDisable(GL_TEXTURE_2D); |
1412 glDisable(GL_TEXTURE_2D); |
1413 //glEnable(GL_LINE_SMOOTH); |
1413 //glEnable(GL_LINE_SMOOTH); |
1414 |
1414 |
1415 glPushMatrix; |
1415 glPushMatrix; |
1416 |
1416 |
1417 glTranslatef(WorldDx, WorldDy, 0); |
1417 glTranslatef(WorldDx, WorldDy, 0); |
1418 |
1418 |
1419 glLineWidth(4.0); |
1419 glLineWidth(4.0); |
1420 |
1420 |
1421 glColor4f(0.8, 0.8, 0.8, 1); |
1421 glColor4f(0.8, 0.8, 0.8, 1); |
1422 |
1422 |
1423 glEnableClientState(GL_VERTEX_ARRAY); |
1423 glEnableClientState(GL_VERTEX_ARRAY); |
1424 glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]); |
1424 glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]); |
1425 glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2); |
1425 glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2); |
1426 glColor4f(1, 1, 1, 1); |
1426 glColor4f(1, 1, 1, 1); |
1427 |
1427 |
1428 glPopMatrix; |
1428 glPopMatrix; |
1429 |
1429 |
1430 glEnable(GL_TEXTURE_2D); |
1430 glEnable(GL_TEXTURE_2D); |
1431 //glDisable(GL_LINE_SMOOTH) |
1431 //glDisable(GL_LINE_SMOOTH) |
1432 end |
1432 end |
1433 end; |
1433 end; |
1434 |
1434 |
1435 procedure DrawRope(Gear: PGear); |
1435 procedure DrawRope(Gear: PGear); |
1436 var roplen: LongInt; |
1436 var roplen: LongInt; |
1437 i: Longword; |
1437 i: Longword; |
1438 |
1438 |
1439 procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt); |
1439 procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt); |
1440 var eX, eY, dX, dY: LongInt; |
1440 var eX, eY, dX, dY: LongInt; |
1441 i, sX, sY, x, y, d: LongInt; |
1441 i, sX, sY, x, y, d: LongInt; |
1442 b: boolean; |
1442 b: boolean; |
1443 begin |
1443 begin |
1444 if (X1 = X2) and (Y1 = Y2) then |
1444 if (X1 = X2) and (Y1 = Y2) then |
1445 begin |
1445 begin |
1446 //OutError('WARNING: zero length rope line!', false); |
1446 //OutError('WARNING: zero length rope line!', false); |
1447 exit |
1447 exit |
1448 end; |
1448 end; |
1449 eX:= 0; |
1449 eX:= 0; |
1450 eY:= 0; |
1450 eY:= 0; |
1451 dX:= X2 - X1; |
1451 dX:= X2 - X1; |
1452 dY:= Y2 - Y1; |
1452 dY:= Y2 - Y1; |
1453 |
1453 |
1454 if (dX > 0) then sX:= 1 |
1454 if (dX > 0) then sX:= 1 |
1455 else |
1455 else |
1456 if (dX < 0) then |
1456 if (dX < 0) then |
1457 begin |
1457 begin |
1458 sX:= -1; |
1458 sX:= -1; |
1459 dX:= -dX |
1459 dX:= -dX |
1460 end else sX:= dX; |
1460 end else sX:= dX; |
1461 |
1461 |
1462 if (dY > 0) then sY:= 1 |
1462 if (dY > 0) then sY:= 1 |
1463 else |
1463 else |
1464 if (dY < 0) then |
1464 if (dY < 0) then |
1465 begin |
1465 begin |
1466 sY:= -1; |
1466 sY:= -1; |
1467 dY:= -dY |
1467 dY:= -dY |
1468 end else sY:= dY; |
1468 end else sY:= dY; |
1469 |
1469 |
1470 if (dX > dY) then d:= dX |
1470 if (dX > dY) then d:= dX |
1471 else d:= dY; |
1471 else d:= dY; |
1472 |
1472 |
1473 x:= X1; |
1473 x:= X1; |
1474 y:= Y1; |
1474 y:= Y1; |
1475 |
1475 |
1476 for i:= 0 to d do |
1476 for i:= 0 to d do |
1477 begin |
1477 begin |
1478 inc(eX, dX); |
1478 inc(eX, dX); |
1479 inc(eY, dY); |
1479 inc(eY, dY); |
1480 b:= false; |
1480 b:= false; |
1481 if (eX > d) then |
1481 if (eX > d) then |
1482 begin |
1482 begin |
1483 dec(eX, d); |
1483 dec(eX, d); |
1484 inc(x, sX); |
1484 inc(x, sX); |
1485 b:= true |
1485 b:= true |
1486 end; |
1486 end; |
1487 if (eY > d) then |
1487 if (eY > d) then |
1488 begin |
1488 begin |
1489 dec(eY, d); |
1489 dec(eY, d); |
1490 inc(y, sY); |
1490 inc(y, sY); |
1491 b:= true |
1491 b:= true |
1492 end; |
1492 end; |
1493 if b then |
1493 if b then |
1494 begin |
1494 begin |
1495 inc(roplen); |
1495 inc(roplen); |
1496 if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0) |
1496 if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0) |
1497 end |
1497 end |
1498 end |
1498 end |
1499 end; |
1499 end; |
1500 begin |
1500 begin |
1501 if cReducedQuality then |
1501 if cReducedQuality then |
1502 DrawRopeLinesRQ(Gear) |
1502 DrawRopeLinesRQ(Gear) |
1503 else |
1503 else |
1504 begin |
1504 begin |
1505 roplen:= 0; |
1505 roplen:= 0; |
1506 if RopePoints.Count > 0 then |
1506 if RopePoints.Count > 0 then |
1507 begin |
1507 begin |
1508 i:= 0; |
1508 i:= 0; |
1509 while i < Pred(RopePoints.Count) do |
1509 while i < Pred(RopePoints.Count) do |
1510 begin |
1510 begin |
1511 DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
1511 DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
1512 hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy); |
1512 hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy); |
1513 inc(i) |
1513 inc(i) |
1514 end; |
1514 end; |
1515 DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
1515 DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
1516 hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); |
1516 hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); |
1517 DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
1517 DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
1518 hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
1518 hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
1519 end else |
1519 end else |
1520 if Gear^.Elasticity.QWordValue > 0 then |
1520 if Gear^.Elasticity.QWordValue > 0 then |
1521 DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
1521 DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
1522 hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
1522 hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
1523 end; |
1523 end; |
1524 |
1524 |
1525 |
1525 |
1526 if RopePoints.Count > 0 then |
1526 if RopePoints.Count > 0 then |
1527 DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle) |
1527 DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle) |
1528 else |
1528 else |
1529 if Gear^.Elasticity.QWordValue > 0 then |
1529 if Gear^.Elasticity.QWordValue > 0 then |
1530 DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1530 DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1531 end; |
1531 end; |
1532 |
1532 |
1533 procedure DrawGears; |
1533 procedure DrawGears; |
1534 var Gear, HHGear: PGear; |
1534 var Gear, HHGear: PGear; |
1535 i: Longword; |
1535 i: Longword; |
1536 begin |
1536 begin |
1537 Gear:= GearsList; |
1537 Gear:= GearsList; |
1538 while Gear<>nil do |
1538 while Gear<>nil do |
1539 begin |
1539 begin |
1540 case Gear^.Kind of |
1540 case Gear^.Kind of |
1541 gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1541 gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1542 gtMolotov: DrawRotated(sprMolotov, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1542 gtMolotov: DrawRotated(sprMolotov, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1543 |
1543 |
1544 gtRCPlane: begin |
1544 gtRCPlane: begin |
1545 if (Gear^.Tag = -1) then |
1545 if (Gear^.Tag = -1) then |
1546 DrawRotated(sprPlane, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) |
1546 DrawRotated(sprPlane, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) |
1547 else |
1547 else |
1548 DrawRotated(sprPlane, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,0,DxDy2Angle(Gear^.dY, Gear^.dX)); |
1548 DrawRotated(sprPlane, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,0,DxDy2Angle(Gear^.dY, Gear^.dX)); |
1549 if ((TrainingFlags and tfRCPlane) <> 0) and (TrainingTargetGear <> nil) and ((Gear^.State and gstDrowning) = 0) then |
1549 if ((TrainingFlags and tfRCPlane) <> 0) and (TrainingTargetGear <> nil) and ((Gear^.State and gstDrowning) = 0) then |
1550 DrawRotatedf(sprFinger, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, GameTicks div 32 mod 16, 0, DxDy2Angle(Gear^.X - TrainingTargetGear^.X, TrainingTargetGear^.Y - Gear^.Y)); |
1550 DrawRotatedf(sprFinger, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, GameTicks div 32 mod 16, 0, DxDy2Angle(Gear^.X - TrainingTargetGear^.X, TrainingTargetGear^.Y - Gear^.Y)); |
1551 end; |
1551 end; |
1552 gtBall: DrawRotatedf(sprBalls, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tag,0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1552 gtBall: DrawRotatedf(sprBalls, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tag,0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1553 |
1553 |
1554 gtDrill: DrawRotated(sprDrill, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1554 gtDrill: DrawRotated(sprDrill, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1555 |
1555 |
1600 gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1); |
1600 gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1); |
1601 gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1601 gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1602 gtCluster: DrawSprite(sprClusterParticle, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, 0); |
1602 gtCluster: DrawSprite(sprClusterParticle, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, 0); |
1603 gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 128 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16); |
1603 gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 128 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16); |
1604 gtParachute: begin |
1604 gtParachute: begin |
1605 DrawSprite(sprParachute, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 48 + WorldDy, 0); |
1605 DrawSprite(sprParachute, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 48 + WorldDy, 0); |
1606 DrawAltWeapon(Gear, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy) |
1606 DrawAltWeapon(Gear, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy) |
1607 end; |
1607 end; |
1608 gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, hwRound(Gear^.X) - SpritesData[sprAirplane].Width div 2 + WorldDx, hwRound(Gear^.Y) - SpritesData[sprAirplane].Height div 2 + WorldDy, 0) |
1608 gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, hwRound(Gear^.X) - SpritesData[sprAirplane].Width div 2 + WorldDx, hwRound(Gear^.Y) - SpritesData[sprAirplane].Height div 2 + WorldDy, 0) |
1609 else DrawSprite(sprAirplane, hwRound(Gear^.X) - SpritesData[sprAirplane].Width div 2 + WorldDx, hwRound(Gear^.Y) - SpritesData[sprAirplane].Height div 2 + WorldDy, 1); |
1609 else DrawSprite(sprAirplane, hwRound(Gear^.X) - SpritesData[sprAirplane].Width div 2 + WorldDx, hwRound(Gear^.Y) - SpritesData[sprAirplane].Height div 2 + WorldDy, 1); |
1610 gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1610 gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1611 gtTeleport: begin |
1611 gtTeleport: begin |
1612 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1612 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1613 if not PHedgehog(Gear^.Hedgehog)^.Unplaced then DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(HHGear^.dX), 0); |
1613 if not PHedgehog(Gear^.Hedgehog)^.Unplaced then DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(HHGear^.dX), 0); |
1614 DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
1614 DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
1615 end; |
1615 end; |
1616 gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12); |
1616 gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12); |
1617 gtTarget: begin |
1617 gtTarget: begin |
1618 glColor4f(1, 1, 1, Gear^.Timer / 1000); |
1618 glColor4f(1, 1, 1, Gear^.Timer / 1000); |
1619 DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
1619 DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
1620 glColor4f(1, 1, 1, 1); |
1620 glColor4f(1, 1, 1, 1); |
1621 end; |
1621 end; |
1622 gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1622 gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1623 gtCake: if Gear^.Pos = 6 then |
1623 gtCake: if Gear^.Pos = 6 then |
1624 DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
1624 DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
1625 else |
1625 else |
1626 DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0); |
1626 DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0); |
1636 end; |
1636 end; |
1637 |
1637 |
1638 procedure FreeGearsList; |
1638 procedure FreeGearsList; |
1639 var t, tt: PGear; |
1639 var t, tt: PGear; |
1640 begin |
1640 begin |
1641 tt:= GearsList; |
1641 tt:= GearsList; |
1642 GearsList:= nil; |
1642 GearsList:= nil; |
1643 while tt <> nil do |
1643 while tt <> nil do |
1644 begin |
1644 begin |
1645 t:= tt; |
1645 t:= tt; |
1646 tt:= tt^.NextGear; |
1646 tt:= tt^.NextGear; |
1647 Dispose(t) |
1647 Dispose(t) |
1648 end; |
1648 end; |
1649 end; |
1649 end; |
1650 |
1650 |
1651 procedure AddMiscGears; |
1651 procedure AddMiscGears; |
1652 var i: LongInt; |
1652 var i: LongInt; |
1653 Gear: PGear; |
1653 Gear: PGear; |
1654 begin |
1654 begin |
1655 AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000); |
1655 AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000); |
1656 |
1656 |
1657 if (TrainingFlags and tfSpawnTargets) <> 0 then |
1657 if (TrainingFlags and tfSpawnTargets) <> 0 then |
1658 begin |
1658 begin |
1659 TrainingTargetGear:= AddGear(0, 0, gtTarget, 0, _0, _0, 0); |
1659 TrainingTargetGear:= AddGear(0, 0, gtTarget, 0, _0, _0, 0); |
1660 FindPlace(TrainingTargetGear, false, 0, LAND_WIDTH); |
1660 FindPlace(TrainingTargetGear, false, 0, LAND_WIDTH); |
1661 end; |
1661 end; |
1662 |
1662 |
1663 if ((GameFlags and gfForts) = 0) then |
1663 if ((GameFlags and gfForts) = 0) then |
1664 begin |
1664 begin |
1665 // TODO: exclude each other or allow both, mines and explosives, on same map? |
1665 // TODO: exclude each other or allow both, mines and explosives, on same map? |
1666 if ((GameFlags and gfMines) <> 0) then |
1666 if ((GameFlags and gfMines) <> 0) then |
1667 for i:= 0 to Pred(cLandAdditions) do |
1667 for i:= 0 to Pred(cLandAdditions) do |
1668 begin |
1668 begin |
1669 Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0); |
1669 Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0); |
1670 Gear^.TriggerId:= i + 1; |
1670 Gear^.TriggerId:= i + 1; |
1671 FindPlace(Gear, false, 0, LAND_WIDTH); |
1671 FindPlace(Gear, false, 0, LAND_WIDTH); |
1672 end; |
1672 end; |
1673 // No game flag for this for now |
1673 // No game flag for this for now |
1674 // if ((GameFlags and gfExplosives) <> 0) then |
1674 // if ((GameFlags and gfExplosives) <> 0) then |
1675 for i:= 0 to Pred(cExplosives) do |
1675 for i:= 0 to Pred(cExplosives) do |
1676 begin |
1676 begin |
1677 Gear:= AddGear(0, 0, gtExplosives, 0, _0, _0, 0); |
1677 Gear:= AddGear(0, 0, gtExplosives, 0, _0, _0, 0); |
1678 FindPlace(Gear, false, 0, LAND_WIDTH); |
1678 FindPlace(Gear, false, 0, LAND_WIDTH); |
1679 end; |
1679 end; |
1680 end; |
1680 end; |
1681 |
1681 |
1682 if (GameFlags and gfLowGravity) <> 0 then |
1682 if (GameFlags and gfLowGravity) <> 0 then |
1683 cGravity:= cMaxWindSpeed / 2; |
1683 cGravity:= cMaxWindSpeed / 2; |
1684 |
1684 |
1685 if (GameFlags and gfVampiric) <> 0 then |
1685 if (GameFlags and gfVampiric) <> 0 then |
1708 {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF} |
1708 {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF} |
1709 if (Radius > 10) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0); |
1709 if (Radius > 10) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0); |
1710 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion); |
1710 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion); |
1711 |
1711 |
1712 if (Mask and EXPLAllDamageInRadius) = 0 then |
1712 if (Mask and EXPLAllDamageInRadius) = 0 then |
1713 dmgRadius:= Radius shl 1 |
1713 dmgRadius:= Radius shl 1 |
1714 else |
1714 else |
1715 dmgRadius:= Radius; |
1715 dmgRadius:= Radius; |
1716 |
1716 |
1717 Gear:= GearsList; |
1717 Gear:= GearsList; |
1718 while Gear <> nil do |
1718 while Gear <> nil do |
1719 begin |
1719 begin |
1720 dmg:= dmgRadius + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
1720 dmg:= dmgRadius + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
1721 if (dmg > 1) and |
1721 if (dmg > 1) and |
1722 ((Gear^.State and gstNoDamage) = 0) then |
1722 ((Gear^.State and gstNoDamage) = 0) then |
1723 begin |
1723 begin |
1724 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
1724 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
1725 case Gear^.Kind of |
1725 case Gear^.Kind of |
1726 gtHedgehog, |
1726 gtHedgehog, |
1727 gtMine, |
1727 gtMine, |
1728 gtCase, |
1728 gtCase, |
1729 gtTarget, |
1729 gtTarget, |
1730 gtFlame, |
1730 gtFlame, |
1731 gtExplosives: begin |
1731 gtExplosives: begin |
1732 //{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
1732 //{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
1733 if (Mask and EXPLNoDamage) = 0 then |
1733 if (Mask and EXPLNoDamage) = 0 then |
1734 begin |
1734 begin |
1735 if not Gear^.Invulnerable then |
1735 if not Gear^.Invulnerable then |
1736 ApplyDamage(Gear, dmg) |
1736 ApplyDamage(Gear, dmg) |
1737 else |
1737 else |
1738 Gear^.State:= Gear^.State or gstWinner; |
1738 Gear^.State:= Gear^.State or gstWinner; |
1739 end; |
1739 end; |
1740 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
1740 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
1741 begin |
1741 begin |
1742 DeleteCI(Gear); |
1742 DeleteCI(Gear); |
1743 Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
1743 Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
1744 Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
1744 Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
1745 Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser); |
1745 Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser); |
1746 if not Gear^.Invulnerable then |
1746 if not Gear^.Invulnerable then |
1747 Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner); |
1747 Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner); |
1748 Gear^.Active:= true; |
1748 Gear^.Active:= true; |
1749 FollowGear:= Gear |
1749 FollowGear:= Gear |
1750 end; |
1750 end; |
1751 end; |
1751 end; |
1752 gtGrave: begin |
1752 gtGrave: begin |
1753 Gear^.dY:= - _0_004 * dmg; |
1753 Gear^.dY:= - _0_004 * dmg; |
1754 Gear^.Active:= true; |
1754 Gear^.Active:= true; |
1755 end; |
1755 end; |
1756 end; |
1756 end; |
1757 end; |
1757 end; |
1758 Gear:= Gear^.NextGear |
1758 Gear:= Gear^.NextGear |
1759 end; |
1759 end; |
1760 |
1760 |
1761 if (Mask and EXPLDontDraw) = 0 then |
1761 if (Mask and EXPLDontDraw) = 0 then |
1762 if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius); |
1762 if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius); |
1763 |
1763 |
1764 uAIMisc.AwareOfExplosion(0, 0, 0) |
1764 uAIMisc.AwareOfExplosion(0, 0, 0) |
1765 end; |
1765 end; |
1766 |
1766 |
1767 procedure ShotgunShot(Gear: PGear); |
1767 procedure ShotgunShot(Gear: PGear); |
1843 begin |
1843 begin |
1844 Gear^.dX:= Ammo^.dX * Power * _0_01; |
1844 Gear^.dX:= Ammo^.dX * Power * _0_01; |
1845 Gear^.dY:= Ammo^.dY * Power * _0_01 |
1845 Gear^.dY:= Ammo^.dY * Power * _0_01 |
1846 end; |
1846 end; |
1847 |
1847 |
1848 Gear^.Active:= true; |
1848 Gear^.Active:= true; |
1849 Gear^.State:= Gear^.State or gstMoving; |
1849 Gear^.State:= Gear^.State or gstMoving; |
1850 |
1850 |
1851 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
1851 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
1852 begin |
1852 begin |
1853 if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
1853 if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
1854 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
1854 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
1855 if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
1855 if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
1856 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
1856 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
1857 if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
1857 if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
1858 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
1858 or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
1859 end; |
1859 end; |
1860 |
1860 |
1861 if (Ammo^.Kind <> gtFlame) or ((Ammo^.State and gsttmpFlag) = 0) then FollowGear:= Gear |
1861 if (Ammo^.Kind <> gtFlame) or ((Ammo^.State and gsttmpFlag) = 0) then FollowGear:= Gear |
1862 end; |
1862 end; |
1863 end |
1863 end |
1864 end; |
1864 end; |
1865 end; |
1865 end; |
1866 if i <> 0 then SetAllToActive |
1866 if i <> 0 then SetAllToActive |
1867 end; |
1867 end; |
1868 |
1868 |
1869 procedure AssignHHCoords; |
1869 procedure AssignHHCoords; |
1870 var i, t, p, j: LongInt; |
1870 var i, t, p, j: LongInt; |
1871 ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
1871 ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
1872 Count: Longword; |
1872 Count: Longword; |
1873 begin |
1873 begin |
1874 if (GameFlags and gfPlaceHog) <> 0 then PlacingHogs:= true; |
1874 if (GameFlags and gfPlaceHog) <> 0 then PlacingHogs:= true; |
1875 if (GameFlags and (gfForts or gfDivideTeams)) <> 0 then |
1875 if (GameFlags and (gfForts or gfDivideTeams)) <> 0 then |
1876 begin |
1876 begin |
1877 t:= 0; |
1877 t:= 0; |
1878 TryDo(ClansCount = 2, 'More or less than 2 clans on map in divided teams mode!', true); |
1878 TryDo(ClansCount = 2, 'More or less than 2 clans on map in divided teams mode!', true); |
1879 for p:= 0 to 1 do |
1879 for p:= 0 to 1 do |
1880 begin |
1880 begin |
1881 with ClansArray[p]^ do |
1881 with ClansArray[p]^ do |
1882 for j:= 0 to Pred(TeamsNumber) do |
1882 for j:= 0 to Pred(TeamsNumber) do |
1883 with Teams[j]^ do |
1883 with Teams[j]^ do |
1884 for i:= 0 to cMaxHHIndex do |
1884 for i:= 0 to cMaxHHIndex do |
1885 with Hedgehogs[i] do |
1885 with Hedgehogs[i] do |
1886 if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1886 if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1887 begin |
1887 begin |
1888 if PlacingHogs then Unplaced:= true |
1888 if PlacingHogs then Unplaced:= true |
1889 else FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil; |
1889 else FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil; |
1890 if Gear <> nil then |
1890 if Gear <> nil then |
1891 begin |
1891 begin |
1892 Gear^.Pos:= GetRandom(49); |
1892 Gear^.Pos:= GetRandom(49); |
1893 Gear^.dX.isNegative:= p = 1; |
1893 Gear^.dX.isNegative:= p = 1; |
1894 end |
1894 end |
1895 end; |
1895 end; |
1896 t:= LAND_WIDTH div 2 |
1896 t:= LAND_WIDTH div 2 |
1897 end |
1897 end |
1898 end else // mix hedgehogs |
1898 end else // mix hedgehogs |
1899 begin |
1899 begin |
1900 Count:= 0; |
1900 Count:= 0; |
1901 for p:= 0 to Pred(TeamsCount) do |
1901 for p:= 0 to Pred(TeamsCount) do |
1902 with TeamsArray[p]^ do |
1902 with TeamsArray[p]^ do |
1903 begin |
1903 begin |
1904 for i:= 0 to cMaxHHIndex do |
1904 for i:= 0 to cMaxHHIndex do |
1905 with Hedgehogs[i] do |
1905 with Hedgehogs[i] do |
1906 if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1906 if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1907 begin |
1907 begin |
1908 ar[Count]:= @Hedgehogs[i]; |
1908 ar[Count]:= @Hedgehogs[i]; |
1909 inc(Count) |
1909 inc(Count) |
1910 end; |
1910 end; |
1911 end; |
1911 end; |
1912 // unC0Rr, while it is true user can watch value on map screen, IMO this (and check above) should be enforced in UI |
1912 // unC0Rr, while it is true user can watch value on map screen, IMO this (and check above) should be enforced in UI |
1913 // - is there a good place to put values for the different widgets to check? Right now they are kind of disconnected. |
1913 // - is there a good place to put values for the different widgets to check? Right now they are kind of disconnected. |
1914 //it would be nice if divide teams, forts mode and hh per map could all be checked by the team widget, or maybe disable start button |
1914 //it would be nice if divide teams, forts mode and hh per map could all be checked by the team widget, or maybe disable start button |
1915 TryDo(Count <= MaxHedgehogs, 'Too many hedgehogs for this map! (max # is ' + inttostr(MaxHedgehogs) + ')', true); |
1915 TryDo(Count <= MaxHedgehogs, 'Too many hedgehogs for this map! (max # is ' + inttostr(MaxHedgehogs) + ')', true); |
1916 while (Count > 0) do |
1916 while (Count > 0) do |
1917 begin |
1917 begin |
1918 i:= GetRandom(Count); |
1918 i:= GetRandom(Count); |
1919 if PlacingHogs then ar[i]^.Unplaced:= true |
1919 if PlacingHogs then ar[i]^.Unplaced:= true |
1920 else FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH); |
1920 else FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH); |
1921 if ar[i]^.Gear <> nil then |
1921 if ar[i]^.Gear <> nil then |
1922 begin |
1922 begin |
1923 ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > LAND_WIDTH div 2; |
1923 ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > LAND_WIDTH div 2; |
1924 ar[i]^.Gear^.Pos:= GetRandom(19) |
1924 ar[i]^.Gear^.Pos:= GetRandom(19) |
1925 end; |
1925 end; |
1926 ar[i]:= ar[Count - 1]; |
1926 ar[i]:= ar[Count - 1]; |
1927 dec(Count) |
1927 dec(Count) |
1928 end |
1928 end |
1929 end |
1929 end |
1930 end; |
1930 end; |
1931 |
1931 |
1932 function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; |
1932 function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; |
1933 var t: PGear; |
1933 var t: PGear; |
1934 begin |
1934 begin |
1935 t:= GearsList; |
1935 t:= GearsList; |
1936 rX:= sqr(rX); |
1936 rX:= sqr(rX); |
1937 rY:= sqr(rY); |
1937 rY:= sqr(rY); |
1938 |
1938 |
1939 while t <> nil do |
1939 while t <> nil do |
1940 begin |
1940 begin |
1941 if (t <> Gear) and (t^.Kind = Kind) then |
1941 if (t <> Gear) and (t^.Kind = Kind) then |
1942 if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then |
1942 if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then |
1943 exit(t); |
1943 exit(t); |
1944 t:= t^.NextGear |
1944 t:= t^.NextGear |
1945 end; |
1945 end; |
1946 |
1946 |
1947 CheckGearNear:= nil |
1947 CheckGearNear:= nil |
1948 end; |
1948 end; |
1949 |
1949 |
1950 {procedure AmmoFlameWork(Ammo: PGear); |
1950 {procedure AmmoFlameWork(Ammo: PGear); |
1951 var t: PGear; |
1951 var t: PGear; |
1952 begin |
1952 begin |
1953 t:= GearsList; |
1953 t:= GearsList; |
1954 while t <> nil do |
1954 while t <> nil do |
1955 begin |
1955 begin |
1956 if (t^.Kind = gtHedgehog) and (t^.Y < Ammo^.Y) then |
1956 if (t^.Kind = gtHedgehog) and (t^.Y < Ammo^.Y) then |
1957 if not (hwSqr(Ammo^.X - t^.X) + hwSqr(Ammo^.Y - t^.Y - int2hwFloat(cHHRadius)) * 2 > _2) then |
1957 if not (hwSqr(Ammo^.X - t^.X) + hwSqr(Ammo^.Y - t^.Y - int2hwFloat(cHHRadius)) * 2 > _2) then |
1958 begin |
1958 begin |
1959 ApplyDamage(t, 5); |
1959 ApplyDamage(t, 5); |
1960 t^.dX:= t^.dX + (t^.X - Ammo^.X) * _0_02; |
1960 t^.dX:= t^.dX + (t^.X - Ammo^.X) * _0_02; |
1961 t^.dY:= - _0_25; |
1961 t^.dY:= - _0_25; |
1962 t^.Active:= true; |
1962 t^.Active:= true; |
1963 DeleteCI(t); |
1963 DeleteCI(t); |
1964 FollowGear:= t |
1964 FollowGear:= t |
1965 end; |
1965 end; |
1966 t:= t^.NextGear |
1966 t:= t^.NextGear |
1967 end; |
1967 end; |
1968 end;} |
1968 end;} |
1969 |
1969 |
1970 function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear; |
1970 function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear; |
1971 var t: PGear; |
1971 var t: PGear; |
1972 begin |
1972 begin |
1973 t:= GearsList; |
1973 t:= GearsList; |
1974 rX:= sqr(rX); |
1974 rX:= sqr(rX); |
1975 rY:= sqr(rY); |
1975 rY:= sqr(rY); |
1976 while t <> nil do |
1976 while t <> nil do |
1977 begin |
1977 begin |
1978 if t^.Kind in Kind then |
1978 if t^.Kind in Kind then |
1979 if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then |
1979 if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then |
1980 exit(t); |
1980 exit(t); |
1981 t:= t^.NextGear |
1981 t:= t^.NextGear |
1982 end; |
1982 end; |
1983 CheckGearsNear:= nil |
1983 CheckGearsNear:= nil |
1984 end; |
1984 end; |
1985 |
1985 |
1986 function CountGears(Kind: TGearType): Longword; |
1986 function CountGears(Kind: TGearType): Longword; |
1987 var t: PGear; |
1987 var t: PGear; |
1988 count: Longword = 0; |
1988 count: Longword = 0; |
1989 begin |
1989 begin |
1990 |
1990 |
1991 t:= GearsList; |
1991 t:= GearsList; |
1992 while t <> nil do |
1992 while t <> nil do |
1993 begin |
1993 begin |
1994 if t^.Kind = Kind then inc(count); |
1994 if t^.Kind = Kind then inc(count); |
1995 t:= t^.NextGear |
1995 t:= t^.NextGear |
1996 end; |
1996 end; |
1997 CountGears:= count; |
1997 CountGears:= count; |
1998 end; |
1998 end; |
1999 |
1999 |
2000 procedure SpawnBoxOfSmth; |
2000 procedure SpawnBoxOfSmth; |
2001 var t: LongInt; |
2001 var t: LongInt; |
2065 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
2065 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
2066 dec(t, Ammoz[i].Probability) |
2066 dec(t, Ammoz[i].Probability) |
2067 end; |
2067 end; |
2068 FollowGear^.Pos:= posCaseUtility; |
2068 FollowGear^.Pos:= posCaseUtility; |
2069 FollowGear^.State:= Longword(i); |
2069 FollowGear^.State:= Longword(i); |
2070 AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpGameState); |
2070 AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpGameState); |
2071 end |
2071 end |
2072 end; |
2072 end; |
2073 end; |
2073 end; |
2074 // handles case of no ammo or utility crates - considered also placing booleans in uAmmos and altering probabilities |
2074 // handles case of no ammo or utility crates - considered also placing booleans in uAmmos and altering probabilities |
2075 if (FollowGear <> nil) then |
2075 if (FollowGear <> nil) then |
2076 begin |
2076 begin |
2077 FindPlace(FollowGear, true, 0, LAND_WIDTH); |
2077 FindPlace(FollowGear, true, 0, LAND_WIDTH); |
2078 |
2078 |
2079 if (FollowGear <> nil) then |
2079 if (FollowGear <> nil) then |
2080 PlaySound(sndReinforce, CurrentTeam^.voicepack) |
2080 PlaySound(sndReinforce, CurrentTeam^.voicepack) |
2081 end |
2081 end |
2082 end; |
2082 end; |
2083 |
2083 |
2084 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); |
2084 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); |
2085 |
2085 |
2086 function CountNonZeroz(x, y, r, c: LongInt): LongInt; |
2086 function CountNonZeroz(x, y, r, c: LongInt): LongInt; |
2087 var i: LongInt; |
2087 var i: LongInt; |
2088 count: LongInt = 0; |
2088 count: LongInt = 0; |
2089 begin |
2089 begin |
2090 if (y and LAND_HEIGHT_MASK) = 0 then |
2090 if (y and LAND_HEIGHT_MASK) = 0 then |
2091 for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do |
2091 for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do |
2092 if Land[y, i] <> 0 then |
2092 if Land[y, i] <> 0 then |
2093 begin |
2093 begin |
2094 inc(count); |
2094 inc(count); |
2095 if count = c then exit(count) |
2095 if count = c then exit(count) |
2096 end; |
2096 end; |
2097 CountNonZeroz:= count; |
2097 CountNonZeroz:= count; |
2098 end; |
2098 end; |
2099 |
2099 |
2100 var x: LongInt; |
2100 var x: LongInt; |
2101 y, sy: LongInt; |
2101 y, sy: LongInt; |
2102 ar: array[0..511] of TPoint; |
2102 ar: array[0..511] of TPoint; |
2103 ar2: array[0..1023] of TPoint; |
2103 ar2: array[0..1023] of TPoint; |
2104 cnt, cnt2: Longword; |
2104 cnt, cnt2: Longword; |
2105 delta: LongInt; |
2105 delta: LongInt; |
2106 begin |
2106 begin |
2107 delta:= 250; |
2107 delta:= 250; |
2108 cnt2:= 0; |
2108 cnt2:= 0; |
2109 repeat |
2109 repeat |
2110 x:= Left + LongInt(GetRandom(Delta)); |
2110 x:= Left + LongInt(GetRandom(Delta)); |
2111 repeat |
2111 repeat |
2112 inc(x, Delta); |
2112 inc(x, Delta); |
2113 cnt:= 0; |
2113 cnt:= 0; |
2114 if topY > 1024 then |
2114 if topY > 1024 then |
2115 y:= 1024-Gear^.Radius * 2 |
2115 y:= 1024-Gear^.Radius * 2 |
2116 else |
2116 else |
2117 y:= topY-Gear^.Radius * 2; |
2117 y:= topY-Gear^.Radius * 2; |
2118 while y < LAND_HEIGHT do |
2118 while y < LAND_HEIGHT do |
2119 begin |
2119 begin |
2120 repeat |
2120 repeat |
2121 inc(y, 2); |
2121 inc(y, 2); |
2122 until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) = 0); |
2122 until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) = 0); |
2123 |
2123 |
2124 sy:= y; |
2124 sy:= y; |
2125 |
2125 |
2126 repeat |
2126 repeat |
2127 inc(y); |
2127 inc(y); |
2128 until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) <> 0); |
2128 until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) <> 0); |
2129 |
2129 |
2130 if (y - sy > Gear^.Radius * 2) and |
2130 if (y - sy > Gear^.Radius * 2) and |
2131 (((Gear^.Kind = gtExplosives) |
2131 (((Gear^.Kind = gtExplosives) |
2132 and (y < LAND_HEIGHT-1) |
2132 and (y < LAND_HEIGHT-1) |
2133 and (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 60, 60) = nil) |
2133 and (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 60, 60) = nil) |
2134 and (CountNonZeroz(x, y+1, Gear^.Radius - 1, Gear^.Radius+1) > Gear^.Radius)) |
2134 and (CountNonZeroz(x, y+1, Gear^.Radius - 1, Gear^.Radius+1) > Gear^.Radius)) |
2135 or |
2135 or |
2136 ((Gear^.Kind <> gtExplosives) |
2136 ((Gear^.Kind <> gtExplosives) |
2137 and (y < LAND_HEIGHT) |
2137 and (y < LAND_HEIGHT) |
2138 and (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 110, 110) = nil))) then |
2138 and (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 110, 110) = nil))) then |
2139 begin |
2139 begin |
2140 ar[cnt].X:= x; |
2140 ar[cnt].X:= x; |
2141 if withFall then ar[cnt].Y:= sy + Gear^.Radius |
2141 if withFall then ar[cnt].Y:= sy + Gear^.Radius |
2142 else ar[cnt].Y:= y - Gear^.Radius; |
2142 else ar[cnt].Y:= y - Gear^.Radius; |
2143 inc(cnt) |
2143 inc(cnt) |
2144 end; |
2144 end; |
2145 |
2145 |
2146 inc(y, 45) |
2146 inc(y, 45) |
2147 end; |
2147 end; |
2148 |
2148 |
2149 if cnt > 0 then |
2149 if cnt > 0 then |
2150 with ar[GetRandom(cnt)] do |
2150 with ar[GetRandom(cnt)] do |
2151 begin |
2151 begin |
2152 ar2[cnt2].x:= x; |
2152 ar2[cnt2].x:= x; |
2153 ar2[cnt2].y:= y; |
2153 ar2[cnt2].y:= y; |
2154 inc(cnt2) |
2154 inc(cnt2) |
2155 end |
2155 end |
2156 until (x + Delta > Right); |
2156 until (x + Delta > Right); |
2157 |
2157 |
2158 dec(Delta, 60) |
2158 dec(Delta, 60) |
2159 until (cnt2 > 0) or (Delta < 70); |
2159 until (cnt2 > 0) or (Delta < 70); |
2160 |
2160 |
2161 if cnt2 > 0 then |
2161 if cnt2 > 0 then |
2162 with ar2[GetRandom(cnt2)] do |
2162 with ar2[GetRandom(cnt2)] do |
2163 begin |
2163 begin |
2164 Gear^.X:= int2hwFloat(x); |
2164 Gear^.X:= int2hwFloat(x); |
2165 Gear^.Y:= int2hwFloat(y); |
2165 Gear^.Y:= int2hwFloat(y); |
2166 {$IFDEF DEBUGFILE} |
2166 {$IFDEF DEBUGFILE} |
2167 AddFileLog('Assigned Gear coordinates (' + inttostr(x) + ',' + inttostr(y) + ')'); |
2167 AddFileLog('Assigned Gear coordinates (' + inttostr(x) + ',' + inttostr(y) + ')'); |
2168 {$ENDIF} |
2168 {$ENDIF} |
2169 end |
2169 end |
2170 else |
2170 else |
2171 begin |
2171 begin |
2172 OutError('Can''t find place for Gear', false); |
2172 OutError('Can''t find place for Gear', false); |
2173 DeleteGear(Gear); |
2173 DeleteGear(Gear); |
2174 Gear:= nil |
2174 Gear:= nil |
2175 end |
2175 end |
2176 end; |
2176 end; |
2177 |
2177 |
2178 function ModifyDamage(dmg: Longword; Gear: PGear): Longword; |
2178 function ModifyDamage(dmg: Longword; Gear: PGear): Longword; |
2179 var i: hwFloat; |
2179 var i: hwFloat; |
2180 begin |
2180 begin |