hedgewars/uChat.pas
changeset 2716 b9ca1bfca24f
parent 2699 249adefa9c1c
child 2948 3f21a9dc93d0
equal deleted inserted replaced
2715:0e4e0db79e2a 2716:b9ca1bfca24f
    20 
    20 
    21 unit uChat;
    21 unit uChat;
    22 
    22 
    23 interface
    23 interface
    24 
    24 
       
    25 procedure init_uChat;
       
    26 procedure free_uChat;
       
    27 
    25 procedure AddChatString(s: shortstring);
    28 procedure AddChatString(s: shortstring);
    26 procedure DrawChat;
    29 procedure DrawChat;
    27 procedure KeyPressChat(Key: Longword);
    30 procedure KeyPressChat(Key: Longword);
    28 
    31 
    29 var UserNick: shortstring = '';
    32 var UserNick: shortstring;
    30     showAll: boolean = false;
    33     showAll: boolean;
    31 
    34 
    32 implementation
    35 implementation
    33 uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uTeams;
    36 uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uTeams;
    34 
    37 
    35 const MaxStrIndex = 27;
    38 const MaxStrIndex = 27;
    40 		Width: LongInt;
    43 		Width: LongInt;
    41 		s: shortstring;
    44 		s: shortstring;
    42 		end;
    45 		end;
    43 
    46 
    44 var Strs: array[0 .. MaxStrIndex] of TChatLine;
    47 var Strs: array[0 .. MaxStrIndex] of TChatLine;
    45 	lastStr: Longword = 0;
    48     lastStr: LongWord;
    46 	visibleCount: Longword = 0;
    49     visibleCount: LongWord;
    47 
    50     InputStr: TChatLine;
    48 	InputStr: TChatLine;
    51     InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char
    49 	InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char
       
    50 
    52 
    51 const colors: array[#1..#4] of TSDL_Color = (
    53 const colors: array[#1..#4] of TSDL_Color = (
    52 	(r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
    54 	(r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
    53 	(r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
    55 	(r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
    54 	(r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
    56 	(r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
   280 	InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0];
   282 	InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0];
   281 	SetLine(InputStr, InputStr.s + utf8, true)
   283 	SetLine(InputStr, InputStr.s + utf8, true)
   282 	end
   284 	end
   283 end;
   285 end;
   284 
   286 
       
   287 procedure init_uChat;
       
   288 begin
       
   289     lastStr:= 0;
       
   290     visibleCount:= 0;
       
   291     UserNick:= '';
       
   292     showAll:= false;
       
   293 end;
       
   294 
       
   295 procedure free_uChat;
       
   296 begin
       
   297 
       
   298 end;
   285 
   299 
   286 end.
   300 end.