hedgewars/uChat.pas
changeset 9669 9fa0f67ff628
parent 9666 8dcb25112d96
child 9676 ce7396d4eaf7
equal deleted inserted replaced
9668:75aab6802a2e 9669:9fa0f67ff628
    27 procedure ReloadLines;
    27 procedure ReloadLines;
    28 procedure CleanupInput;
    28 procedure CleanupInput;
    29 procedure AddChatString(s: shortstring);
    29 procedure AddChatString(s: shortstring);
    30 procedure DrawChat;
    30 procedure DrawChat;
    31 procedure KeyPressChat(Key, Sym: Longword);
    31 procedure KeyPressChat(Key, Sym: Longword);
       
    32 procedure SendHogSpeech(s: shortstring);
    32 
    33 
    33 implementation
    34 implementation
    34 uses SDLh, uInputHandler, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO;
    35 uses SDLh, uInputHandler, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO;
    35 
    36 
    36 const MaxStrIndex = 27;
    37 const MaxStrIndex = 27;
   240         SendHogSpeech(char(x) + char(t) + copy(s, 2, Length(s)-2));
   241         SendHogSpeech(char(x) + char(t) + copy(s, 2, Length(s)-2));
   241     exit
   242     exit
   242     end;
   243     end;
   243 
   244 
   244 // These 3 are same as above, only are to make the hedgehog say it on next attack
   245 // These 3 are same as above, only are to make the hedgehog say it on next attack
   245 if (s[1] = '/') and (copy(s, 1, 5) = '/hsa ') then
   246 if (s[1] = '/') then
   246     begin
   247     begin
   247     if CurrentTeam^.ExtDriven then
   248     if (copy(s, 1, 5) = '/hsa ') then
   248         ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
   249         begin
   249     else
   250         if CurrentTeam^.ExtDriven then
   250         SendHogSpeech(#4 + copy(s, 6, Length(s)-5));
   251             ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
   251     exit
   252         else
   252     end;
   253             SendHogSpeech(#4 + copy(s, 6, Length(s)-5));
   253 if (s[1] = '/') and (copy(s, 1, 5) = '/hta ') then
   254         exit
   254     begin
   255         end;
   255     if CurrentTeam^.ExtDriven then
   256 
   256         ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
   257     if (copy(s, 1, 5) = '/hta ') then
   257     else
   258         begin
   258         SendHogSpeech(#5 + copy(s, 6, Length(s)-5));
   259         if CurrentTeam^.ExtDriven then
   259     exit
   260             ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
   260     end;
   261         else
   261 if (s[1] = '/') and (copy(s, 1, 5) = '/hya ') then
   262             SendHogSpeech(#5 + copy(s, 6, Length(s)-5));
   262     begin
   263         exit
   263     if CurrentTeam^.ExtDriven then
   264         end;
   264         ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
   265 
   265     else
   266     if (copy(s, 1, 5) = '/hya ') then
   266         SendHogSpeech(#6 + copy(s, 6, Length(s)-5));
   267         begin
   267     exit
   268         if CurrentTeam^.ExtDriven then
   268     end;
   269             ParseCommand('/say ' + copy(s, 6, Length(s)-5), true)
   269 
   270         else
   270 if (copy(s, 1, 6) = '/team ') and (length(s) > 6) then
   271             SendHogSpeech(#6 + copy(s, 6, Length(s)-5));
   271     begin
   272         exit
   272     ParseCommand(s, true);
   273         end;
   273     exit
   274 
   274     end;
   275     if (copy(s, 1, 6) = '/team ') and (length(s) > 6) then
   275 if (s[1] = '/') and (copy(s, 1, 4) <> '/me ') then
   276         begin
   276     begin
   277         ParseCommand(s, true);
   277     if CurrentTeam^.ExtDriven or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
   278         exit
   278         exit;
   279         end;
   279 
   280 
   280     for i:= Low(TWave) to High(TWave) do
   281     if (copy(s, 1, 4) <> '/me ') then
   281         if (s = Wavez[i].cmd) then
   282         begin
   282             begin
   283         if CurrentTeam^.ExtDriven or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
   283             ParseCommand('/taunt ' + char(i), true);
   284             exit;
   284             exit
   285 
   285             end;
   286         for i:= Low(TWave) to High(TWave) do
   286 
   287             if (s = Wavez[i].cmd) then
   287     for j:= Low(TChatCmd) to High(TChatCmd) do
   288                 begin
   288         if (s = ChatCommandz[j].ChatCmd) then
   289                 ParseCommand('/taunt ' + char(i), true);
   289             begin
   290                 exit
   290             ParseCommand(ChatCommandz[j].ProcedureCallChatCmd, true);
   291                 end;
   291             exit
   292 
   292             end;
   293         for j:= Low(TChatCmd) to High(TChatCmd) do
       
   294             if (s = ChatCommandz[j].ChatCmd) then
       
   295                 begin
       
   296                 ParseCommand(ChatCommandz[j].ProcedureCallChatCmd, true);
       
   297                 exit
       
   298                 end;
       
   299         end
       
   300         else
       
   301             ParseCommand('/say ' + s, true);
   293     end
   302     end
   294     else
       
   295         ParseCommand('/say ' + s, true);
       
   296 end;
   303 end;
   297 
   304 
   298 procedure CleanupInput;
   305 procedure CleanupInput;
   299 begin
   306 begin
   300     FreezeEnterKey;
   307     FreezeEnterKey;