hedgewars/CCHandlers.inc
changeset 2042 905c554d62e6
parent 2022 9bbf8af42ace
child 2045 b0588498bc3a
equal deleted inserted replaced
2041:9e0b5a6bcecf 2042:905c554d62e6
   389      MsgParam:= byte(s[1])
   389      MsgParam:= byte(s[1])
   390      end
   390      end
   391 end;
   391 end;
   392 
   392 
   393 procedure chHogSay(var s: shortstring);
   393 procedure chHogSay(var s: shortstring);
   394 var Gear: PGear;
   394 var Gear: PVisualGear;
   395     text: shortstring;
   395     text: shortstring;
   396 begin
   396 begin
   397 text:= copy(s, 2, Length(s)-1);
   397 text:= copy(s, 2, Length(s)-1);
   398 if CheckNoTeamOrHH or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then
   398 if CheckNoTeamOrHH or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then
   399     begin
   399     begin
   400     chSay(text);
   400     chSay(text);
   401     exit
   401     exit
   402     end;
   402     end;
   403 
   403 
   404 if not CurrentTeam^.ExtDriven then SendIPC('h' + s);
   404 if not CurrentTeam^.ExtDriven then SendIPC('h' + s);
       
   405 
   405 if byte(s[1]) < 4 then
   406 if byte(s[1]) < 4 then
   406     begin
   407     begin
   407     Gear:= AddGear(0, 0, gtSpeechBubble, 0, _0, _0, 0);
   408     Gear:= AddVisualGear(0, 0, vgtSpeechBubble);
       
   409     Gear^.Hedgehog:= CurrentHedgehog;
   408     Gear^.Text:= text;
   410     Gear^.Text:= text;
   409     Gear^.Hedgehog:= CurrentHedgehog;
   411     Gear^.FrameTicks:= byte(s[1])
   410     Gear^.State:= byte(s[1]);
       
   411     end
   412     end
   412 else
   413 else
   413     begin
   414     begin
   414     // If I knew how to add a gear without it becoming immediately active, I'd
       
   415     // just create/attach the hedgehog SpeechGear here, then activate it where
       
   416     // SpeechType/SpeechText are activated
       
   417     SpeechType:= byte(s[1])-3;
   415     SpeechType:= byte(s[1])-3;
   418     SpeechText:= text
   416     SpeechText:= text
   419     end;
   417     end;
       
   418 
   420 end;
   419 end;
   421 
   420 
   422 procedure chNewGrave;
   421 procedure chNewGrave;
   423 begin
   422 begin
   424 if CheckNoTeamOrHH then exit;
   423 if CheckNoTeamOrHH then exit;