633 if not racerActive then |
633 if not racerActive then |
634 if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then |
634 if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then |
635 |
635 |
636 wpX[wpCount] = x |
636 wpX[wpCount] = x |
637 wpY[wpCount] = y |
637 wpY[wpCount] = y |
|
638 wpCol[wpCount] = 0xffffffff |
|
639 wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true) |
|
640 |
|
641 local flashing, minO, maxO |
638 if wpCount == 0 then |
642 if wpCount == 0 then |
639 wpCol[wpCount] = 0x80ff80ff |
643 -- First waypoint flashes. Useful to know since this is the spawn position. |
|
644 minO, maxO = 164, 255 |
|
645 flashing = 5 |
640 else |
646 else |
641 wpCol[wpCount] = 0xffffffff |
647 -- Other waypoints are not animated (before the race starts) |
|
648 minO, maxO = 255, 255 |
|
649 flashing = 0 |
642 end |
650 end |
643 wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true) |
651 SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], minO, maxO, 1, flashing, 0, wpRad, 5, wpCol[wpCount]) |
644 |
652 |
645 SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 164, 224, 1, 10, 0, wpRad, 5, wpCol[wpCount]) |
653 -- Make last waypoint white while making all previous ones light gray. |
|
654 -- Note the last waypoint can be deleted with Precise. |
|
655 SetVisualGearValues(wpCirc[wpCount-1], nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xaaaaaaff) |
646 |
656 |
647 wpCount = wpCount + 1 |
657 wpCount = wpCount + 1 |
648 |
658 |
649 if placedByUser then |
659 if placedByUser then |
650 AddCaption(string.format(loc("Waypoint placed. Available points remaining: %d"), wpLimit-wpCount)) |
660 AddCaption(string.format(loc("Waypoint placed. Available points remaining: %d"), wpLimit-wpCount)) |
665 wpX[wpCount] = nil |
675 wpX[wpCount] = nil |
666 wpY[wpCount] = nil |
676 wpY[wpCount] = nil |
667 wpCol[wpCount] = nil |
677 wpCol[wpCount] = nil |
668 DeleteVisualGear(wpCirc[wpCount]) |
678 DeleteVisualGear(wpCirc[wpCount]) |
669 wpCirc[wpCount] = nil |
679 wpCirc[wpCount] = nil |
|
680 SetVisualGearValues(wpCirc[wpCount-1], nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xffffffff) |
670 AddCaption(string.format(loc("Waypoint removed. Available points: %d"), wpLimit-wpCount)) |
681 AddCaption(string.format(loc("Waypoint removed. Available points: %d"), wpLimit-wpCount)) |
671 else |
682 else |
672 PlaySound(sndDenied) |
683 PlaySound(sndDenied) |
673 AddCaption(loc("No waypoint to be removed!")) |
684 AddCaption(loc("No waypoint to be removed!")) |
674 end |
685 end |
701 |
712 |
702 currCount = 0 -- hopefully this solves problem |
713 currCount = 0 -- hopefully this solves problem |
703 AddAmmo(CurrentHedgehog, amAirAttack, 0) |
714 AddAmmo(CurrentHedgehog, amAirAttack, 0) |
704 gTimer = 0 |
715 gTimer = 0 |
705 |
716 |
706 -- Set the waypoints to unactive on new round |
|
707 if not gameOver then |
|
708 for i = 0,(wpCount-1) do |
|
709 wpActive[i] = false |
|
710 wpCol[i] = 0xffffffff |
|
711 SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 164, 224, 1, 10, 0, wpRad, 5, wpCol[i]) |
|
712 end |
|
713 end |
|
714 |
|
715 -- Handle Starting Stage of Game |
717 -- Handle Starting Stage of Game |
716 if (gameOver == false) and (gameBegun == false) then |
718 if (gameOver == false) and (gameBegun == false) then |
717 if wpCount >= 2 then |
719 if wpCount >= 2 then |
718 gameBegun = true |
720 gameBegun = true |
719 roundNumber = 0 |
721 roundNumber = 0 |
732 end |
734 end |
733 ShowMission(loc("Racer"), |
735 ShowMission(loc("Racer"), |
734 loc("Waypoint placement phase"), infoString, 2, 4000) |
736 loc("Waypoint placement phase"), infoString, 2, 4000) |
735 AddAmmo(CurrentHedgehog, amAirAttack, 4000) |
737 AddAmmo(CurrentHedgehog, amAirAttack, 4000) |
736 SetWeapon(amAirAttack) |
738 SetWeapon(amAirAttack) |
|
739 end |
|
740 end |
|
741 |
|
742 -- Set the waypoints to unactive on new round |
|
743 if gameBegun and not gameOver then |
|
744 for i = 0,(wpCount-1) do |
|
745 wpActive[i] = false |
|
746 wpCol[i] = 0xffffffff |
|
747 local flashing, minO, maxO |
|
748 if i == 0 then |
|
749 -- Make first waypoint flash very noticably |
|
750 minO, maxO = 92, 255 |
|
751 flashing = 2 |
|
752 else |
|
753 minO, maxO = 164, 224 |
|
754 flashing = 10 |
|
755 end |
|
756 SetVisualGearValues(wpCirc[i], nil, nil, minO, maxO, nil, flashing, nil, nil, nil, wpCol[i]) |
737 end |
757 end |
738 end |
758 end |
739 |
759 |
740 if gameOver == true then |
760 if gameOver == true then |
741 gameBegun = false |
761 gameBegun = false |