hedgewars/uChat.pas
changeset 1033 622c5de38d72
parent 1001 502508979713
child 1034 05f003ad3caa
equal deleted inserted replaced
1032:bf6f5122baf7 1033:622c5de38d72
    26 
    26 
    27 var UserNick: shortstring = '';
    27 var UserNick: shortstring = '';
    28 	showAll: boolean = false;
    28 	showAll: boolean = false;
    29 
    29 
    30 implementation
    30 implementation
    31 uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys;
    31 uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uGears, uTeams;
    32 
    32 
    33 const MaxStrIndex = 27;
    33 const MaxStrIndex = 27;
    34 
    34 
    35 type TChatLine = record
    35 type TChatLine = record
    36 		s: shortstring;
    36 		s: shortstring;
   115 if (GameState = gsChat)
   115 if (GameState = gsChat)
   116 	and (InputStr.Tex <> nil) then
   116 	and (InputStr.Tex <> nil) then
   117 	DrawTexture(8, visibleCount * 16 + 10, InputStr.Tex);
   117 	DrawTexture(8, visibleCount * 16 + 10, InputStr.Tex);
   118 end;
   118 end;
   119 
   119 
       
   120 procedure AcceptChatString(s: shortstring);
       
   121 begin
       
   122 if (s = '/rollup') and not CurrentTeam^.ExtDriven then
       
   123 	with CurrentHedgehog^.Gear^ do
       
   124 		begin
       
   125 		Message:= Message or gm_Animate;
       
   126 		MsgParam:= Longword(sprKowtow)
       
   127 		end
       
   128 else
       
   129 	ParseCommand('/say ' + s, true);
       
   130 end;
       
   131 
   120 procedure KeyPressChat(Key: Longword);
   132 procedure KeyPressChat(Key: Longword);
   121 const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0);
   133 const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0);
   122 var i, btw: integer;
   134 var i, btw: integer;
   123     utf8: shortstring;
   135     utf8: shortstring;
   124 begin
   136 begin
   131 				end;
   143 				end;
   132 		27: SetLine(InputStr, '', true);
   144 		27: SetLine(InputStr, '', true);
   133 		13, 271: begin
   145 		13, 271: begin
   134 			if Length(InputStr.s) > 0 then
   146 			if Length(InputStr.s) > 0 then
   135 				begin
   147 				begin
   136 				ParseCommand('/say ' + InputStr.s, true);
   148 				AcceptChatString(InputStr.s);
   137 				SetLine(InputStr, '', false)
   149 				SetLine(InputStr, '', false)
   138 				end;
   150 				end;
   139 			FreezeEnterKey;
   151 			FreezeEnterKey;
   140 			GameState:= gsGame
   152 			GameState:= gsGame
   141 			end
   153 			end