hedgewars/uChat.pas
changeset 8745 b3756c3f65e5
parent 8743 0097855532f6
child 8833 c13ebed437cb
child 9080 9b42757d7e71
equal deleted inserted replaced
8744:6c87486fd89b 8745:b3756c3f65e5
   193 
   193 
   194     if i = 0 then
   194     if i = 0 then
   195         i:= MaxStrIndex
   195         i:= MaxStrIndex
   196     else
   196     else
   197         dec(i);
   197         dec(i);
   198         
   198 
   199     inc(cnt);
   199     inc(cnt);
   200     inc(t)
   200     inc(t)
   201     end;
   201     end;
   202 
   202 
   203 visibleCount:= cnt;
   203 visibleCount:= cnt;
   217 begin
   217 begin
   218 t:= LocalTeam;
   218 t:= LocalTeam;
   219 x:= 0;
   219 x:= 0;
   220 if (s[1] = '"') and (s[Length(s)] = '"')
   220 if (s[1] = '"') and (s[Length(s)] = '"')
   221     then x:= 1
   221     then x:= 1
   222     
   222 
   223 else if (s[1] = '''') and (s[Length(s)] = '''') then
   223 else if (s[1] = '''') and (s[Length(s)] = '''') then
   224     x:= 2
   224     x:= 2
   225     
   225 
   226 else if (s[1] = '-') and (s[Length(s)] = '-') then
   226 else if (s[1] = '-') and (s[Length(s)] = '-') then
   227     x:= 3;
   227     x:= 3;
   228     
   228 
   229 if not CurrentTeam^.ExtDriven and (x <> 0) then
   229 if not CurrentTeam^.ExtDriven and (x <> 0) then
   230     for c:= 0 to Pred(TeamsCount) do
   230     for c:= 0 to Pred(TeamsCount) do
   231         if (TeamsArray[c] = CurrentTeam) then
   231         if (TeamsArray[c] = CurrentTeam) then
   232             t:= c;
   232             t:= c;
   233 
   233 
   281             begin
   281             begin
   282             ParseCommand('/taunt ' + char(i), true);
   282             ParseCommand('/taunt ' + char(i), true);
   283             exit
   283             exit
   284             end;
   284             end;
   285 
   285 
   286 	for j:= Low(TChatCmd) to High(TChatCmd) do
   286     for j:= Low(TChatCmd) to High(TChatCmd) do
   287         if (s = ChatCommandz[j].ChatCmd) then
   287         if (s = ChatCommandz[j].ChatCmd) then
   288             begin
   288             begin
   289             ParseCommand(ChatCommandz[j].ProcedureCallChatCmd, true);
   289             ParseCommand(ChatCommandz[j].ProcedureCallChatCmd, true);
   290             exit
   290             exit
   291             end;
   291             end;
   307 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0);
   307 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0);
   308 var i, btw, index: integer;
   308 var i, btw, index: integer;
   309     utf8: shortstring;
   309     utf8: shortstring;
   310     action: boolean;
   310     action: boolean;
   311 begin
   311 begin
   312     action:= false;
   312     action:= true;
   313     case Sym of
   313     case Sym of
   314         SDLK_BACKSPACE:
   314         SDLK_BACKSPACE:
   315             begin
   315             begin
   316             action:= true;
       
   317             if Length(InputStr.s) > 0 then
   316             if Length(InputStr.s) > 0 then
   318                 begin
   317                 begin
   319                 InputStr.s[0]:= InputStrL[byte(InputStr.s[0])];
   318                 InputStr.s[0]:= InputStrL[byte(InputStr.s[0])];
   320                 SetLine(InputStr, InputStr.s, true)
   319                 SetLine(InputStr, InputStr.s, true)
   321                 end
   320                 end
   322             end;
   321             end;
   323         SDLK_ESCAPE: 
   322         SDLK_ESCAPE:
   324             begin
   323             begin
   325             action:= true;
   324             if Length(InputStr.s) > 0 then
   326             if Length(InputStr.s) > 0 then 
       
   327                 SetLine(InputStr, '', true)
   325                 SetLine(InputStr, '', true)
   328             else CleanupInput
   326             else CleanupInput
   329             end;
   327             end;
   330         SDLK_RETURN:
   328         SDLK_RETURN:
   331             begin
   329             begin
   332             action:= true;
       
   333             if Length(InputStr.s) > 0 then
   330             if Length(InputStr.s) > 0 then
   334                 begin
   331                 begin
   335                 AcceptChatString(InputStr.s);
   332                 AcceptChatString(InputStr.s);
   336                 SetLine(InputStr, '', false)
   333                 SetLine(InputStr, '', false)
   337                 end;
   334                 end;
   338             CleanupInput
   335             CleanupInput
   339             end;
   336             end;
   340         SDLK_UP, SDLK_DOWN:
   337         SDLK_UP, SDLK_DOWN:
   341             begin
   338             begin
   342             action:= true;
       
   343             if (Sym = SDLK_UP) and (history < localLastStr) then inc(history);
   339             if (Sym = SDLK_UP) and (history < localLastStr) then inc(history);
   344             if (Sym = SDLK_DOWN) and (history > 0) then dec(history);
   340             if (Sym = SDLK_DOWN) and (history > 0) then dec(history);
   345             index:= localLastStr - history + 1;
   341             index:= localLastStr - history + 1;
   346             if (index > localLastStr) then
   342             if (index > localLastStr) then
   347                  SetLine(InputStr, '', true)
   343                  SetLine(InputStr, '', true)
   348             else SetLine(InputStr, LocalStrs[index], true)
   344             else SetLine(InputStr, LocalStrs[index], true)
   349             end
   345             end;
       
   346         SDLK_RIGHT, SDLK_LEFT, SDLK_DELETE,
       
   347         SDLK_HOME, SDLK_END,
       
   348         SDLK_PAGEUP, SDLK_PAGEDOWN:
       
   349             begin
       
   350             // ignore me!!!
       
   351             end;
       
   352         else
       
   353             action:= false;
   350         end;
   354         end;
   351     if not action and (Key <> 0) then
   355     if not action and (Key <> 0) then
   352         begin
   356         begin
   353         if (Key < $80) then
   357         if (Key < $80) then
   354             btw:= 1
   358             btw:= 1