892 if (CurrentTeam <> nil) then |
892 if (CurrentTeam <> nil) then |
893 with CurrentTeam^ do |
893 with CurrentTeam^ do |
894 for i:= 0 to cMaxHHIndex do |
894 for i:= 0 to cMaxHHIndex do |
895 with Hedgehogs[i] do |
895 with Hedgehogs[i] do |
896 begin |
896 begin |
|
897 (* |
897 if (SpeechGear <> nil) then |
898 if (SpeechGear <> nil) then |
898 begin |
899 begin |
899 DeleteVisualGear(SpeechGear); // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue |
900 DeleteVisualGear(SpeechGear); // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue |
900 SpeechGear:= nil |
901 SpeechGear:= nil |
901 end; |
902 end; |
|
903 *) |
902 |
904 |
903 if (Gear <> nil) then |
905 if (Gear <> nil) then |
904 begin |
906 begin |
905 if (GameFlags and gfInvulnerable) = 0 then |
907 if (GameFlags and gfInvulnerable) = 0 then |
906 Gear^.Invulnerable:= false; |
908 Gear^.Invulnerable:= false; |
1741 end; |
1743 end; |
1742 |
1744 |
1743 procedure chHogSay(var s: shortstring); |
1745 procedure chHogSay(var s: shortstring); |
1744 var Gear: PVisualGear; |
1746 var Gear: PVisualGear; |
1745 text: shortstring; |
1747 text: shortstring; |
1746 begin |
1748 hh: PHedgehog; |
1747 text:= copy(s, 2, Length(s) - 1); |
1749 i, x, t, h: byte; |
1748 if CheckNoTeamOrHH |
1750 c, j: LongInt; |
1749 or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then |
1751 begin |
|
1752 hh:= nil; |
|
1753 i:= 0; |
|
1754 x:= byte(s[1]); // speech type |
|
1755 t:= byte(s[2]); // team |
|
1756 h:= byte(s[3]); // target hog |
|
1757 // allow targetting a hog by specifying a number as the first portion of the text |
|
1758 if (h > byte('0')) and (h < byte('9')) then i:= h - 48; |
|
1759 if i <> 0 then text:= copy(s, 4, Length(s) - 1) |
|
1760 else text:= copy(s, 3, Length(s) - 1); |
|
1761 if CheckNoTeamOrHH then |
1750 begin |
1762 begin |
1751 ParseCommand('say ' + text, true); |
1763 ParseCommand('say ' + text, true); |
1752 exit |
1764 exit |
1753 end; |
1765 end; |
1754 |
1766 |
1755 if not CurrentTeam^.ExtDriven then SendIPC('h' + s); |
1767 if not CurrentTeam^.ExtDriven then SendIPC('h' + s); |
1756 |
1768 |
1757 if byte(s[1]) < 4 then |
1769 if (x < 4) and (TeamsArray[t] <> nil) then |
1758 begin |
1770 begin |
1759 Gear:= AddVisualGear(0, 0, vgtSpeechBubble); |
1771 // if team matches current hedgehog team, default to current hedgehog |
|
1772 if (i = 0) and (CurrentHedgehog^.Team = TeamsArray[t]) then hh:= CurrentHedgehog |
|
1773 else |
|
1774 begin |
|
1775 // otherwise use the first living hog or the hog amongs the remaining ones indicated by i |
|
1776 j:= 0; |
|
1777 c:= 0; |
|
1778 while (j <= cMaxHHIndex) and (hh = nil) do |
|
1779 begin |
|
1780 if (TeamsArray[t]^.Hedgehogs[j].Gear <> nil) then |
|
1781 begin |
|
1782 inc(c); |
|
1783 if (i=0) or (i=c) then |
|
1784 hh:= @TeamsArray[t]^.Hedgehogs[j] |
|
1785 end; |
|
1786 inc(j) |
|
1787 end |
|
1788 end; |
|
1789 if hh <> nil then Gear:= AddVisualGear(0, 0, vgtSpeechBubble); |
1760 if Gear <> nil then |
1790 if Gear <> nil then |
1761 begin |
1791 begin |
1762 Gear^.Hedgehog:= CurrentHedgehog; |
1792 Gear^.Hedgehog:= hh; |
1763 Gear^.Text:= text; |
1793 Gear^.Text:= text; |
1764 Gear^.FrameTicks:= byte(s[1]) |
1794 Gear^.FrameTicks:= x |
1765 end |
1795 end |
|
1796 else ParseCommand('say ' + text, true) |
1766 end |
1797 end |
1767 else |
1798 else |
1768 begin |
1799 begin |
1769 SpeechType:= byte(s[1])-3; |
1800 SpeechType:= x-3; |
1770 SpeechText:= text |
1801 SpeechText:= text |
1771 end; |
1802 end; |
1772 end; |
1803 end; |
1773 |
1804 |
1774 procedure initModule; |
1805 procedure initModule; |