hedgewars/uChat.pas
changeset 5392 1840da0c1f1d
parent 5100 951767beffc8
child 6286 835392304f81
equal deleted inserted replaced
5390:f41e87de8989 5392:1840da0c1f1d
    49     InputStr: TChatLine;
    49     InputStr: TChatLine;
    50     InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char
    50     InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char
    51     ChatReady: boolean;
    51     ChatReady: boolean;
    52     showAll: boolean;
    52     showAll: boolean;
    53 
    53 
    54 const colors: array[#1..#5] of TSDL_Color = (
    54 const colors: array[#1..#6] of TSDL_Color = (
    55     (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
    55     (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
    56     (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
    56     (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
    57     (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
    57     (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
    58     (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow]
    58     (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow]
    59     (r:$FF; g:$00; b:$00; unused:$ff)  // error messages [Red]
    59     (r:$FF; g:$00; b:$00; unused:$FF), // error messages [Red]
       
    60     (r:$00; g:$FF; b:$FF; unused:$FF)  // input line [Light Blue]
    60     );
    61     );
    61 
    62 
    62 procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean);
    63 procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean);
    63 var strSurface, resSurface: PSDL_Surface;
    64 var strSurface, resSurface: PSDL_Surface;
    64     w, h: LongInt;
    65     w, h: LongInt;
    70 
    71 
    71 cl.s:= str;
    72 cl.s:= str;
    72 
    73 
    73 if isInput then
    74 if isInput then
    74 begin
    75 begin
    75     // [Light Blue]
    76     color:= colors[#6];
    76     color.r:= $00;
       
    77     color.g:= $FF;
       
    78     color.b:= $FF;
       
    79     color.unused:= $FF;
       
    80     str:= UserNick + '> ' + str + '_'
    77     str:= UserNick + '> ' + str + '_'
    81 end
    78 end
    82 else
    79 else
    83 begin
    80 begin
    84     color:= colors[str[1]];
    81     color:= colors[str[1]];
   151     DrawTexture(8 - cScreenWidth div 2, visibleCount * 16 + 10, InputStr.Tex);
   148     DrawTexture(8 - cScreenWidth div 2, visibleCount * 16 + 10, InputStr.Tex);
   152     end;
   149     end;
   153 
   150 
   154 dec(r.y, 16);
   151 dec(r.y, 16);
   155 
   152 
   156 while
   153 while (((t < 7) and (Strs[i].Time > RealTicks)) or
   157     (
   154        ((t < MaxStrIndex) and showAll)) and
   158             ((t < 7) and (Strs[i].Time > RealTicks))
   155       (Strs[i].Tex <> nil) do
   159         or
       
   160             ((t < MaxStrIndex) and showAll)
       
   161     )
       
   162     and
       
   163         (Strs[i].Tex <> nil) do
       
   164     begin
   156     begin
   165     r.w:= Strs[i].Width;
   157     r.w:= Strs[i].Width;
   166     DrawFillRect(r);
   158     DrawFillRect(r);
   167     Tint($00, $00, $00, $80);
   159     Tint($00, $00, $00, $80);
   168     DrawTexture(9 - cScreenWidth div 2, (visibleCount - t) * 16 - 5, Strs[i].Tex);
   160     DrawTexture(9 - cScreenWidth div 2, (visibleCount - t) * 16 - 5, Strs[i].Tex);