hedgewars/CCHandlers.inc
changeset 2017 7845c77c8d31
parent 1850 a0332e79fdc9
child 2022 9bbf8af42ace
--- a/hedgewars/CCHandlers.inc	Sun Apr 26 15:47:03 2009 +0000
+++ b/hedgewars/CCHandlers.inc	Thu Apr 30 20:13:44 2009 +0000
@@ -390,6 +390,35 @@
      end
 end;
 
+procedure chHogSay(var s: shortstring);
+var Gear: PGear;
+    text: shortstring;
+begin
+text:= copy(s, 2, Length(s)-1);
+if CheckNoTeamOrHH or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then
+    begin
+    chSay(text);
+    exit
+    end;
+
+if not CurrentTeam^.ExtDriven then SendIPC('h' + s);
+if byte(s[1]) < 4 then
+    begin
+    Gear:= AddGear(0, 0, gtSpeechBubble, 0, _0, _0, 0);
+    Gear^.Text:= text;
+    Gear^.Hedgehog:= CurrentHedgehog;
+    Gear^.State:= byte(s[1]);
+    end
+else
+    begin
+    // If I knew how to add a gear without it becoming immediately active, I'd
+    // just create/attach the hedgehog SpeechGear here, then activate it where
+    // SpeechType/SpeechText are activated
+    SpeechType:= byte(s[1]);
+    SpeechText:= text
+    end;
+end;
+
 procedure chNewGrave;
 begin
 if CheckNoTeamOrHH then exit;